Skip to content
\n

installed \"league-connect\" via npm, I copy pasted this and got \"ws.subscribe is not a function\", the same goes with ws.on(...

","upvoteCount":1,"answerCount":2,"acceptedAnswer":{"@type":"Answer","text":"

Are you using TypeScript? I think there might be some issues with the typedefs exported so I'm going to look into that.

\n

I ran this js snippet on Node 14.15.4 using league-connect 5.0.2 and it seems to work just fine for me.

\n
const {\n    authenticate,\n    connect\n} = require('league-connect')\n\nasync function main() {\n    const credentials = await authenticate()\n    console.log(credentials)\n\n    const ws = await connect(credentials)\n\n    ws.on('message', message => {\n        console.log(message)\n    })\n    ws.subscribe('/lol-chat/v1/conversations/active', (data, event) => {\n        console.log(data)\n    })\n}\n\nmain()
","upvoteCount":1,"url":"https://github.com/junlarsen/league-connect/discussions/43#discussioncomment-367747"}}}

Subscribing does not exist #43

Answered by junlarsen
VC4427 asked this question in Q&A
Discussion options

You must be logged in to vote

Are you using TypeScript? I think there might be some issues with the typedefs exported so I'm going to look into that.

I ran this js snippet on Node 14.15.4 using league-connect 5.0.2 and it seems to work just fine for me.

const {
    authenticate,
    connect
} = require('league-connect')

async function main() {
    const credentials = await authenticate()
    console.log(credentials)

    const ws = await connect(credentials)

    ws.on('message', message => {
        console.log(message)
    })
    ws.subscribe('/lol-chat/v1/conversations/active', (data, event) => {
        console.log(data)
    })
}

main()

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by junlarsen
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #41 on February 14, 2021 15:16.