-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace 'express-ws' #1
Comments
|
Why?Issues with |
Progess can now be tracked at #5 |
solved with #5 |
The npm package
express-ws
does not seem to support broadcasting to a clients on a specific route or context.For example Imagine Client A creates a game on the ws-route
../game/lobby/<unique_key_1>
.Client B joins the game via a private link
../game/<unique_key_1>
.We now want to broadcast to everyone connected to
../game/<unique_key_1>/join
that a new client has joined, and thus update the UI on both ends. Telling them how many players are in the game.The issue right now is that broadcasting on a specific route is not possible in
express-ws
. I.e if we where to broadcast the newGame
state to all clients; A Client C would also receive that message. The message would contain data such as<unique_key_1>
.Client C should not have access to such information, but now has, and can now hijack the game, and join via
../game/<unique_key_1>/join
. Even though Client C never received an invite.This issue was discussed here: https://gist.github.com/hugosp/5eeb2a375157625e21d33d75d10574df
OP sugest a solution:
But as highlited in the issue ticket,
getWss()
does not supportpath/route
as argumenthttps://github.com/HenningM/express-ws/blob/master/src/index.js#L80
A possible solution was discussed as follows:
After investigation however; it does not seem like
ws
has any propertyroute
. Which renders this solution invalid forexpress-ws@latest
This issue was further discussed in a PR a while back
HenningM/express-ws#122
But has as of yet not been merged. The owner of the PR has a fork for the project, which might be worth looking into.
https://github.com/aral/express-ws
The text was updated successfully, but these errors were encountered: