Support for a Node.js server for WebSocketFramework messages.
An alias of WebSocketServer.Socket.
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.
messageToPlayerid extracts a PlayerId from a message, if there is one.
autoDeleteGame is called when all sockets referencing a GameId have disconnected. If it returns True, then the game will be put on deathwatch, meaning it will be removed from the tables after a delay. Usually used to keep public games from being auto-deleted.
gamesDeleter is called when games are deleted due to their sockets being disconnected. See the ServerGamesDeleter description for more details.
playersDeleter is called when players are deleted due to their sockets being disconnected. See the ServerPlayersDeleter description for more details.
inputPort and outputPort are the ports used to communicate with the Node.js code.
User function that is called to send the response(s) to a request.
This will usually call sendToOne 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.
The ServerState arg is the value of the state property of the WrappedModel arg, pulled out for your convenience. If you change it, you must put it back in the model you return.
Called when games are auto-deleted due to socket connections being lost.
This will only happen if your server code tracks the association between sockets, games and players in the xxxDict properties of the Model. When tracked games are dropped, this function, stored in the gamesDeleter property of UserFunctions, is called, so that you can clean up any reference to those games in your gamestate.
It is called BEFORE the game information is removed from the ServerState.
Called when players are auto-deleted due to socket connections being lost.
This will only happen if your server code tracks the association between sockets, games and players in the xxxDict properties of the Model. When tracked players are dropped, this function, stored in the playersDelete property of UserFunctions, is called, so that you can clean up any reference to those players in your gamestate.
It is called BEFORE the player information is removed from the ServerState.
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, which is stored in the ServerModel, accessible via getServerModel.
Encode a message to a single socket via an output port.
If the first arg is True, log the operation on the console.
Encode a message to multiple sockets via an output port.
If the first arg is True, log the operation on the console.
Encode a message to all the sockets for a GameId except the passed one.
If (verbose model) is true, log the operation on the console.
Encode a message to all the sockets for a GameId.
If (verbose model) is true, log the operation on the console.
Get the servermodel from a model.
Set the ServerState in a model.
Get the servermodel from a model.
Set the servermodel in a model.
Get the death row duration from a model.
This is the time a game or player sticks around after no connections reference it.
Set the death row duration in a model.
This is the time a game or player sticks around after no connections reference it.
Get the current time from a model.
The time is updated once a second.
Return sockets associated with a game.
Removes the passed socket from the list.
Often useful in ServerMessageSender functions to send responses to all players.
Return whether VERBOSE is set in the server's environment
An opaque type containing the application state.