Skip to content

Commit 89dfd78

Browse files
committed
Fix health socket not getting client messages
Forgot to resume. Went ahead and did the same for the test plugin although it only sends messages and doesn't receive any.
1 parent f442b03 commit 89dfd78

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/node/routes/health.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ router.get("/", (req, res) => {
1313
export const wsRouter = WsRouter()
1414

1515
wsRouter.ws("/", async (req) => {
16-
wss.handleUpgrade(req, req.socket, req.head, (ws) => {
17-
ws.on("message", () => {
16+
req.ws.resume()
17+
wss.handleUpgrade(req, req.ws, req.head, (ws) => {
18+
ws.addEventListener("message", () => {
1819
ws.send(
1920
JSON.stringify({
2021
event: "health",

test/test-plugin/src/index.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ export const plugin: cs.Plugin = {
2828
wsRouter() {
2929
const wr = cs.WsRouter()
3030
wr.ws("/test-app", (req) => {
31-
cs.wss.handleUpgrade(req, req.socket, req.head, (ws) => {
31+
req.ws.resume()
32+
cs.wss.handleUpgrade(req, req.ws, req.head, (ws) => {
3233
ws.send("hello")
3334
})
3435
})

0 commit comments

Comments
 (0)