Skip to content

Commit

Permalink
Update for pauth 2.0.0 & correctly disconnect
Browse files Browse the repository at this point in the history
  • Loading branch information
LucienHH committed Feb 4, 2023
1 parent 3195be5 commit a5a8ea0
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions examples/connectionid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { XboxRTA } = require('xbox-rta');
const { Authflow, Titles } = require('prismarine-auth');

const main = async () => {
const auth = new Authflow('example', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo' });
const auth = new Authflow('example', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' });

const rta = new XboxRTA(auth);

Expand All @@ -13,8 +13,9 @@ const main = async () => {
console.log(sub);

setTimeout(async () => {
console.log('Unsubscribing');
await rta.disconnect();
}, 60000);
}, 15000);

};

Expand Down
2 changes: 1 addition & 1 deletion examples/userpresence.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const { XboxRTA } = require('xbox-rta');
const { Authflow, Titles } = require('prismarine-auth');

const main = async () => {
const auth = new Authflow('example', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo' });
const auth = new Authflow('example', './', { authTitle: Titles.MinecraftNintendoSwitch, deviceType: 'Nintendo', flow: 'live' });

const rta = new XboxRTA(auth);

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"debug": "^4.3.4",
"prismarine-auth": "^1.7.0",
"prismarine-auth": "^2.2.0",
"xbox-rta": "file:."
}
}
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class XboxRTA extends RTAClient {
await sub.unsubscribe();
}

clearTimeout(this.reconnectTimeout);
clearTimeout(this.pingTimeout);

debug('Disconnecting from RTA');

this.ws.close();
Expand Down

0 comments on commit a5a8ea0

Please sign in to comment.