uncategorized commonNetworkRoomParams - wxyz-abcd/node-haxball GitHub Wiki
The keys for this object can be grouped in two categories:
-
storage: Storage
: An object that stores information about the current player preferences. (documentation) -
noPluginMechanism: boolean
: Iftrue
, renderer and plugin mechanism will not work. Should only be used for optimal performance. You have to defineRoom._onXXXXXX
callbacks by yourself. -
config: RoomConfig | null
: TheRoomConfig
object that contains all the main callbacks of this room. Default value isnull
. Note that the api will generate an empty config if you do not provide one. Look at examples/roomConfigs/method2 folder for example RoomConfigs to use here, or src/roomConfigTemplate_method2.js for a template RoomConfig that contains all callbacks. (documentation) -
renderer: Renderer | null
: TheRenderer
object that will render the game. The object should be derived from the providedRenderer
class. Default value isnull
. Look at examples/renderers folder for example Renderers to use here, or src/rendererTemplate.js for a template Renderer that contains all callbacks. (documentation) -
plugins: Plugin[]
: An array ofPlugin
objects to be used. the objects should be derived from the providedPlugin
class. Default value is[]
. Look at examples/plugins folder for example Plugins to use here, or src/pluginTemplate.js for a template Plugin that contains all callbacks. (documentation) -
libraries: Library[]
: An array ofLibrary
objects to be used. The objects should be derived from the providedLibrary
class. Default value is[]
. Look at examples/libraries folder for example Library's to use here, or src/libraryTemplate.js for a template Library that contains all callbacks. (documentation) -
version: int
: Haxball's version number. Other clients cannot join this room if their version number is different than this number. Default value is9
. -
proxyAgent
: Any http(s)/socks5 proxy agent that may be applied to the websocket connections. Does not work in browsers. Default value isnull
. -
identityToken
: A token that represents a user data in a database of a custom proxy/backend server. Defaults tonull
.
-
preInit(room: Room): void
Called just after the
room
object is created, and before the initialization of the addons. This is where you can initialize/add your custom GUI functions to the room object to be used inside the addons.Parameters:
-
room: Room
: The room object that was just created. (documentation)
Return value: void.
-
-
onOpen(room: Room): void
Called when joining or creating a room was successful.
Parameters:
-
room: Room
: The room that succeeded in being created/joined. (documentation)
Return value: void.
-
-
onClose(error: HBError): void
Called when joining/creating a room failed, room.leave() was called, or the room was closed.
Parameters:
-
error: HBError
: The error that caused the failure. Will benull
ifroom.leave()
was called. (documentation)
Return value: void.
-
-
onConnInfo(state: ConnectionState, extraInfo: string|undefined): void
Triggered when the connection's state changed, or started trying the reverse connection method while joining a room.
Parameters:
-
state: ConnectionState
: The new connection state. (documentation) -
extraInfo: string|HBError|undefined
: Extra information depending on the connection state:- if
state
isConnectingToPeer
orAwaitingState
: The session description value for webrtc connection. - if
state
isConnectionFailed
: The error object that may contain information about why the connection failed. - otherwise:
undefined
.
- if
Return value: void.
-