backend: better socket handling
This commit is contained in:
@@ -78,10 +78,11 @@ apiRouter.post("/volume", async (req, res) => {
|
||||
});
|
||||
|
||||
apiRouter.ws("/events", (ws, req) => {
|
||||
console.log(req.query);
|
||||
console.log("Events client connected");
|
||||
mediaPlayer.subscribe(ws);
|
||||
|
||||
ws.on("close", () => {
|
||||
console.log("Events client disconnected");
|
||||
mediaPlayer.unsubscribe(ws);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user