Skip to content

Commit a3062da

Browse files
committed
feat: update to bloop version 2 protocol
BREAKING CHANGE: This requires a server implementing the version 2 protocol.
1 parent a9cb333 commit a3062da

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/network/Client.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ class Client {
3030
});
3131

3232
const stream = new BufferedStream(socket);
33-
34-
const credentials = `${clientId}:${clientSecret}`;
35-
stream.writeUint8(credentials.length);
36-
stream.writeAll(Buffer.from(credentials, 'ascii'));
33+
stream.writeUint8(clientId.length);
34+
stream.writeAll(Buffer.from(clientId, 'ascii'));
35+
stream.writeUint8(clientSecret.length);
36+
stream.writeAll(Buffer.from(clientSecret, 'ascii'));
37+
stream.writeUint8(4);
38+
stream.writeAll(Buffer.from([192, 168, 0, 1]));
3739

3840
const result = await stream.readUint8();
3941

@@ -62,7 +64,7 @@ class Client {
6264
const achievements = [];
6365

6466
for (let i = 0; i < numAchievements; ++i) {
65-
achievements.push(await this.stream.readExact(20));
67+
achievements.push(await this.stream.readExact(16));
6668
}
6769

6870
return achievements;
@@ -74,6 +76,7 @@ class Client {
7476
}
7577

7678
public disconnect() : void {
79+
this.stream.writeUint8(0x03);
7780
this.stream.close();
7881
}
7982
}

0 commit comments

Comments
 (0)