Skip to content

Commit 315dd0d

Browse files
committed
add encoding parameter
1 parent c91b0f1 commit 315dd0d

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

lib/ws/event-handler.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ export class EventHandler {
128128
"background: #9CFC97; color: black; border-radius: 3px 0 0 3px;",
129129
"background: #353A47; color: white; border-radius: 0 3px 3px 0"
130130
);
131-
const ws = new WebSocket("wss://aether-ws-dev.gaminggeek.dev/website");
131+
const ws = new WebSocket(
132+
"wss://aether-ws-dev.gaminggeek.dev/website?encoding=zlib"
133+
);
132134
return this.setWebsocket(ws, true);
133135
});
134136
} catch {

src/pages/_app.tsx

+15-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,10 @@ import useWebsocket from "../hooks/use-websocket";
1414
export const emitter = new Emitter();
1515

1616
const MyApp = ({ Component, pageProps }: AppProps) => {
17-
const [handler] = useWebsocket("wss://aether-ws-dev.gaminggeek.dev/website", emitter);
17+
const [handler] = useWebsocket(
18+
"wss://aether-ws-dev.gaminggeek.dev/website?encoding=zlib",
19+
emitter
20+
);
1821
if (handler) {
1922
initHandler(handler);
2023
}
@@ -29,19 +32,19 @@ const MyApp = ({ Component, pageProps }: AppProps) => {
2932
};
3033

3134
const initHandler = async (handler: EventHandler) => {
32-
const events = ["SUBSCRIBE"] // may be populated with more in the future
33-
for (const event of events) emitter.removeAllListeners(event)
35+
const events = ["SUBSCRIBE"]; // may be populated with more in the future
36+
for (const event of events) emitter.removeAllListeners(event);
3437
emitter.on("SUBSCRIBE", (route, extra) => {
35-
handler.handleSubscribe(route, extra)
36-
})
37-
if (!handler.identified) handler.identify()
38-
const devToolsCheck = /./
38+
handler.handleSubscribe(route, extra);
39+
});
40+
if (!handler.identified) handler.identify();
41+
const devToolsCheck = /./;
3942
devToolsCheck.toString = () => {
4043
// dev tools is open
41-
handler.devToolsWarning()
42-
return ""
43-
}
44-
console.log("%c", devToolsCheck)
45-
}
44+
handler.devToolsWarning();
45+
return "";
46+
};
47+
console.log("%c", devToolsCheck);
48+
};
4649

4750
export default MyApp;

0 commit comments

Comments
 (0)