Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error this.client.rest.endpoint #44

Closed
pabx06 opened this issue Sep 29, 2018 · 2 comments
Closed

Error this.client.rest.endpoint #44

pabx06 opened this issue Sep 29, 2018 · 2 comments

Comments

@pabx06
Copy link

pabx06 commented Sep 29, 2018

trying with nodejs code:

var RPC=require('discord-rpc');
const clientId = 'XXXXXXXXXXXXXXXX';
const scopes = ['rpc', 'rpc.api', 'messages.read'];

const client = new RPC.Client({ transport: 'websocket' });

client.on('ready', () => {
    console.log('Logged in as', client.application.name);
    console.log('Authed for user', client.user.username);

    client.selectVoiceChannel('81384788862181376');
});

// Log in to RPC with client id
client.login({ clientId, scopes });

I get the error

discordtest\node_modules\discord-rpc\src\transports\WebSocket.js:52
    this.client.rest.endpoint = `http://${this.hostAndPort}`;
                              ^

TypeError: Cannot set property 'endpoint' of undefined
    at WebSocketTransport.onOpen (C:\Users\pbx06\WebstormProjects\discordtest\node_modules\discord-rpc\src\transports\WebSocket.js:52:31)
    at WebSocket.onOpen (C:\Users\pbx06\WebstormProjects\discordtest\node_modules\discord-rpc\node_modules\ws\lib\event-target.js:132:16)
    at WebSocket.emit (events.js:182:13)
    at WebSocket.setSocket (C:\Users\pbx06\WebstormProjects\discordtest\node_modules\discord-rpc\node_modules\ws\lib\websocket.js:151:10)
    at ClientRequest.req.on (C:\Users\pbx06\WebstormProjects\discordtest\node_modules\discord-rpc\node_modules\ws\lib\websocket.js:602:10)
    at ClientRequest.emit (events.js:182:13)
    at Socket.socketOnData (_http_client.js:453:11)
    at Socket.emit (events.js:182:13)
    at addChunk (_stream_readable.js:280:12)
    at readableAddChunk (_stream_readable.js:265:11)
Waiting for the debugger to disconnect...

Process finished with exit code 1
@pabx06 pabx06 changed the title this.client.rest.endpoint Error this.client.rest.endpoint Sep 29, 2018
@didinele
Copy link
Member

Hmm, this does not look like the latest commit hash: 905c282

Also this seems to have been fixed on this commit: 624eac1

Could try re-installing the lib?

@devsnek
Copy link
Member

devsnek commented Sep 29, 2018

this was fixed in 624eac1

@devsnek devsnek closed this as completed Sep 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants