This commit is contained in:
Holly Stubbs 2024-04-28 12:51:04 +01:00
parent 720ffdb8a1
commit 7e646efd28
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E
2 changed files with 3 additions and 7 deletions

View file

@ -28,12 +28,12 @@ export default class Client {
}, 1000);
const client = new Socket();
client.on("open", () => {
client.on("connect", () => {
// Send off auth as soon as we connect
client.write(createWriter(Endian.LE, 2 + config.authKey.length).writeUByte(Packet.Auth).writeShortString(config.authKey).toBuffer());
});
client.on("message", (data) => {
client.on("data", (data) => {
// @ts-ignore
const packetData = createReader(Endian.LE, data);
const packetId = packetData.readUByte();

View file

@ -25,11 +25,7 @@ export default class Server {
socket.end(Constants.KEEPALIVE_PACKET);
}, 5000);
socket.on("message", (data, isBinary) => {
if (!isBinary) {
return;
}
socket.on("data", (data) => {
// NOTE: The types declarations for ws are really messed up >:(
// @ts-ignore
const packetData = createReader(Endian.LE, data);