-
Notifications
You must be signed in to change notification settings - Fork 55
ServerConfiguration
Greg edited this page May 6, 2015
·
35 revisions
These are passed to cloak.configure() before calling cloak.run() See ServerAPI for more details on running the server.
-
portto run on -
expressExpress server to run on. Use instead ofport. example -
gameLoopSpeedhow frequently do game loop "pulses" happen in ms. default 100 -
defaultRoomSizeMaximum number of players in a room. Default null (no maximum) but can be any number 1 or greater. Set to 1 for a single player game. -
autoJoinLobbydefault true. Players automatically join the lobby after connecting, when leaving a room, etc. -
autoCreateRoomsdefault false. create rooms as soon as there are enough users in the lobby to meet theminRoomMembers. When a room is created, players in the lobby are automatically added. -
minRoomMembersIf a room reaches minRoomMembers, then falls below that many members, the room is closed. When used withautoCreateRooms, this is the minimum number of lobby members required for a room to be created. Default null. -
pruneEmptyRoomsIf a room is empty for this many milliseconds it is closed. Default null. -
reconnectWaithow long the server waits (in milliseconds) for a user to reconnect before deleting them and removing them from any rooms they're in. default 10000. set tonullto wait forever -
reconnectWaitRoomlessoverridereconnectWaitfor users that are not in a room. defaultnullwhich means same asreconnectWaitNote: this wait time refers to how long they have been disconnected total, not how long since they left a room. -
roomLifehow long in ms a room is open before it automatically closes. set to null for infinite. default null -
notifyRoomChangessendroomCreatedandroomDeletedserver events to lobby members. default true -
messages- custom events to handle messages from client. The parameters are the message argument from the client and the User object.
-
room-
initcallback on new room -
pulsecalled periodically for rooms -
newMembercalled when a new member joins the room.thisis the room, function arg is the user -
memberLeavescalled when a member leaves the room.thisis the room, function arg is the user -
closecallback on closing of room -
shouldAllowUserfunction that takes a user and returns true if the user is allowed to join at this time. default is to always allow users to join rooms
-
-
lobby- has the same events as
room(see above) but they only apply to the lobby
- has the same events as
-
clientEvents-
begina client has connected for the first time. Argument is the user object. -
disconnecta client has disconnected. Argument is the user object. -
resumea client has reconnected. Argument is the user object.
-
-
socketIo- You can pass through socket.IO server configuration options here.
All documentation on this wiki is licensed under a Creative Commons Attribution 3.0 Unported License. To attribute simply link to this wiki.