-
-
Notifications
You must be signed in to change notification settings - Fork 526
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
Moving Client room-to-room #65
Comments
Hi @oyed, Currently, the only way to achieve this is by manually sending a message from the server to the client you want to move, and, from the client-side, request to join into that room. See dummy example below: Server-side:
Client-side
|
@endel Thanks - can I persist Client (Player) Data through rooms? |
@oyed you're welcome! You'd need to persist the user data somewhere in between connections, such as a database or in memory. I wouldn't recommend persisting in NodeJS's process, since when upgrading to the next version of the server ( |
This is something I do as well (I have an RPG where each map is a room). Basically, I do it exactly as endel described - I tell the client to teleport, and the client initiates the request. I do some cleanup on the server, save the player, then when it leaves the room and joins the next one, the x, y, etc are already set. When the next version comes out, you'll be able to do promise validation in canJoin which will make it so you can check the database to verify that the map you're on is the map you should be on (for example). |
Thanks for the help! |
after 3 years. is there any update? |
Hi @xfause, there are a couple of different ways of achieving this. What I do on mazmorra is:
A more "secure" way of handling this, would be to use the You still need to connect and disconnect from the rooms manually, as the framework does not consider how your front-end is structured. |
Can someone please elaborate the syntax in more detail? I'm facing difficulty in this exact scenario. As every time I leave a room , i'm getting "WebSocket is already in CLOSING or CLOSED state." error. Thank you. |
why can't we force join a client |
@atuncer the problem I see currently in allowing the SERVER to force the client to join is that we don't have a declarative way for the CLIENT to properly listen to this event and set up its callbacks. I'm very open to an API/feature proposal to allow this. It would be nice to have this feature for version |
Is this possible? For example, having Rooms as Maps in an MMO game. Once a "door" is triggered, the room will move the player to the next specified room.
The text was updated successfully, but these errors were encountered: