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._onXXXXXXcallbacks by yourself. -
config: RoomConfig | null: TheRoomConfigobject 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: TheRendererobject that will render the game. The object should be derived from the providedRendererclass. 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 ofPluginobjects to be used. the objects should be derived from the providedPluginclass. 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 ofLibraryobjects to be used. The objects should be derived from the providedLibraryclass. 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. -
debugDesync: For a host room, can betrue. For a client room, can be a callback function with parametershostRoomStateandclientRoomState. (Look at https://github.com/wxyz-abcd/node-haxball/tree/main/examples/other/compareStates.js for the default implementation of desync checking.) This callback is called whenever a desync occurs if the host room'sdebugDesyncvalue is alsotrue. Defaults tonull.
-
preInit(room: Room): void
Called just after the
roomobject 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 benullifroom.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
stateisConnectingToPeerorAwaitingState: The session description value for webrtc connection. - if
stateisConnectionFailed: The error object that may contain information about why the connection failed. - otherwise:
undefined.
- if
Return value: void.
-