exports

  • wrapper of a socket Socket + buffer of the last game state send to client (allow to send stateDiff)

Constructor

new exports(socket, userDataopt)

Send game state to client

Parameters:
NameTypeAttributesDescription
socketSocket

socket to wrap

userDataobject<optional>

user data

Members

lastStateSend :State|null

last state send to client use to compute GameStateDiff

Type:
  • State | null

socket :Socket

socket embeded

Type:
  • Socket

userData :object

Type:
  • object

Methods

sendState(stateJSON)

Send a statediff or a state to client

Parameters:
NameTypeDescription
stateJSONobject

state serialized