You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using mock-socket in new version of my game. I wanted to add some test coverage.
I have a test case that one user is already created a game then second user can join. Somehow I found some ugly solutions but I I couldn't find any example when I need to broadcast to players who joined the game.
I assumed mockServer.emit could be the solution but I couldn't say specifally, just send message for players who joined the game.
I asummed people who wants to play with mockServer.clients() would like to see an example, it would be nice to mention there's dispatchEvent to send something to client because my original server code uses client.send to reach same functionality. It can cause conflict for many people.
@keremciu Thank you so much for these links! Your implementation helped me to understand the whole thing better! And huge shout out to @thoov as well making it even possible! All the best for you fellas! ;)
I'm using
mock-socket
in new version of my game. I wanted to add some test coverage.I have a test case that one user is already created a game then second user can join. Somehow I found some ugly solutions but I I couldn't find any example when I need to broadcast to players who joined the game.
I assumed
mockServer.emit
could be the solution but I couldn't say specifally, just send message for players who joined the game.I implemented a solution this way:
https://github.com/keremciu/house-of-decks/blob/ws-implement/client/src/utils/server-mock.js#L32-L42
I asummed people who wants to play with
mockServer.clients()
would like to see an example, it would be nice to mention there'sdispatchEvent
to send something to client because my original server code usesclient.send
to reach same functionality. It can cause conflict for many people.https://github.com/keremciu/house-of-decks/blob/ws-implement/server/index.js#L62
The text was updated successfully, but these errors were encountered: