question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot subscribe to some RPC events, the events do not fire

See original GitHub issue

My application has to detect when the user joins to a voice channel and then detect updates on that voice channel. The VOICE_CHANNEL_SELECT event is working fine, but VOICE_STATE_CREATE / VOICE_STATE_UPDATE / VOICE_STATE_DELETE events do not fire at all.

The event API just for convenience: https://discord.com/developers/docs/topics/rpc#commands-and-events

const RPC = require('discord-rpc');

const cfg = {
  clientId: 'hidden',
  clientSecret: 'hidden',
  scopes: ['rpc']
}

RPC.register(cfg.clientId);

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

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

  client.subscribe('VOICE_CHANNEL_SELECT', function (channel) {  // This one works fine
    if (channel.channel_id == null) return;

    client.subscribe('VOICE_STATE_CREATE', channel, (voice_status) => {  // This one and the ones below never fire
      console.log(voice_status);
    });

    client.subscribe('VOICE_STATE_UPDATE', channel, (voice_status) => {
      console.log(voice_status);
    });

    client.subscribe('VOICE_STATE_DELETE', channel, (voice_status) => {
      console.log(voice_status);
    });
  }
}

client.login({ clientId: cfg.clientId, clientSecret: cfg.clientSecret, scopes: cfg.scopes, redirectUri: 'https://localhost:8080/authorize'}).catch(console.error);

any thoughts? thanks in advance.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
devsnekcommented, Jun 14, 2021

this issue has been resolved as of v4.0.1

0reactions
jinheicommented, Jun 14, 2021

@devsnek not sure why these issues / PRs were closed – the issue still exists. I have my personal projects pointing at my github branch as a dep, as this issue is not fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Real-time Events | go-ethereum
How to subscribe to events using JSON-RPC notifications.
Read more >
Subscribe to Platform Events Unit | Salesforce Trailhead
With platform events, the process is similar. You simply write an after insert Apex trigger on the event object to subscribe to incoming...
Read more >
Event based transparent Client/Server RPC framework
Event ::RPC consists of a server and a client library. The server exports a list of classes and methods, which are allowed to...
Read more >
Synapse failed to unsubscribe to events for event trigger ...
Synapse tries to delete something that does not exist anymore and fails to do ... Id has Contributor access to the event grid...
Read more >
RPCs and RaiseEvent - Fusion Introduction | Photon Engine
We will support Unity 2022 with PUN 2, but no new features will be added. ... already used by Photon itself, so you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found