I'm attempting to build a realtime multiplayer game server in Golang using websockets as a learning project, and I'm having difficulty understanding how exactly I'm supposed to implement this concept:
All of the users in a game room are given a duration, MAX_TIMEOUT
to respond to a prompt provided. Responses are submitted via websocket connections. If all of the users respond before MAX_TIMEOUT
, then Action A
should happen, using the responses. If MAX_TIMEOUT
elapses before all of the prompts are submitted, then Action B
should happen, using the responses available.
Coming from Node.JS, I could see myself implementing this with Promises, but in Golang, I'm rather lost.
Any advice?