Closed majorsimon closed 2 years ago
On further investigation, it appears as though the work for #133 was lost, and something in #31c66358782a3b311be1ca1a8abc572562021d18 to add a "new sub model" did not take. I have forked, reinstating #133
Can you provide an example of non-working code?
const clientId = 'TEST';
const authToken = "TOKEN";
const scopes = [
"rpc",
"rpc.activities.write",
"rpc.voice.read",
"rpc.voice.write",
"rpc.notifications.read",
];
const client = new RPC.Client({ transport: 'ipc' });
await client.login({ clientId: clientId, scopes: scopes, accessToken: authToken });
console.log('Logged in as', client.application.name);
console.log('Authed for user', client.user.username);
client.subscribe("VOICE_CONNECTION_STATUS", (data: any) => {
console.log("VOICE_CONNECTION_STATUS_SUB msg received");
};
client.subscribe("VOICE_SETTINGS_UPDATE", (data: any) => {
console.log("VOICE_SETTINGS_UPDATE msg received");
};
You should be doing this:
client.on('VOICE_CONNECTION_STATUS', () => {});
client.on('VOICE_SETTINGS_UPDATE', () => {});
client.subscribe("VOICE_CONNECTION_STATUS");
client.subscribe("VOICE_SETTINGS_UPDATE");
Cool that works - thanks!
Hi there,
I am writing an application which turns on/off certain switches depending on the user's current settings/state (e.g. setting a light GREEN if connected to voice, red/amber otherwise; turning another couple of lights on/off depending on whether or not user is muted/deafened, etc.).
However, I have found that I cannot get either of the subscriptions to work! On v3.2. 0 the first subscription made would work, and not any subsequent ones. On v4.0.1, it appears as though neither are working. The two events I am attempting to subscribe to are
VOICE_SETTINGS_UPDATE
andVOICE_CONNECTION_STATUS
.This certainly smells like it's related to the existing (closed) PRs and Issues #133 #110 and #121. I note that both of the tested events are niladic - could this be part of the issue? I haven't had a chance to investigate the new(ish) subscription manager added yet.