Support for a Node.js server for WebSocketFramework messages.
The messages processed by our update function.
Connection, Disconnection, and SocketMessage from through the inputPort from the Node.JS code. FirstTick and Tick are used to track time. Noop does nothing.
User function that is called to send the response(s) to a request.
This will usually call sentToOne and/or sendToMany with the message emitted by the ServiceMessageProcessor in the UserFunctions passed to program.
The first message is the request that came from client to server. The second message is the response. If no response is returned by the ServiceMessageProcessor, this function is not called.
User functions that get called by the generic server code.
encodeDecode is used to translate messages to and from strings.
messageProcessor processes a client request into state changes and a response message.
messageSender decides what to do with the response message.
messageToGameid extracts a GameId from a message, if there is one.
inputPort and outputPort are the ports used to communicate with the Node.js code.
A type wrapper to prevent recursive types in Model.
Create the top-level application program.
You will usually use the result of this function as the value of main in your top-level module.
Most servers will not need to use the servermodel, but it's a place to stash extra server-wide state that doesn't make sense in the game-specific gamestate.
Return the initial Model and a Cmd to get the current time.
Usually called for you by program.
Send a message to a single socket.
Send a message to a multiple sockets.
Generate a random GameId string, ensuring that it is not already assigned to a game.
Will not be used by servers that have no concept of a game.
Generate a random PlayerId string, ensuring that it is not already assigned to a player.
Will not be used by servers that have no concept of a player.
The server application model.
programcreates one of these, via a call toinit.