How does Mini Program realize the friend-to-friend mode? the back end is php.

RT
how does Mini Program realize the friend-to-friend mode? the back end is php.
looking for onlookers to fight. How are these two modes realized? What is the principle?
ask the hero for advice. This is the first time to do this

.
Feb.26,2021

the overall idea is the room ID+ invitation code mechanism (or no invitation code).

1. When the owner creates a room and generates the room ID, to share with others, create an invitation code (the invitation code can be set to check by time, times, etc.)
2. When others join the room by sharing links with parameters, verify the room ID and invitation code
3 to the server. If the room ID does not exist or the room is full, the join fails; if the invitation code expires and is invalid, the joining condition is not met
4. When the player enters the room, set up a websocket. When the requirements for the start of the battle are met, the server pushes the battle to begin.

SP: onlookers enter the room in order to ID, but the invitation code has expired, the battle status of the room has begun, and so on, they have entered the bystander state. When entering, send openid and room id, to the server to establish websocket, to get the status of whether the player is online or not.


I haven't done websocket, yet. I'll study it slowly. Thank you


did the landlord realize this function? Can you share the details of the implementation? Thank you!

Menu