uncategorized haxballClient - wxyz-abcd/node-haxball GitHub Wiki
The keys for this object can be grouped in three 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
. -
kickTimeout: int
: When we kick the ball, it causes us to release kick button by default. This API changes it so that it causes a timeout that makes us automatically press kick button again. We may assign a negative value to disable this feature. Default value is-1
. -
proxyAgent
: Any http(s)/socks5 proxy agent that may be applied to the websocket connections. Does not work in browsers. Default value isnull
. -
room: Room
: Do not modify this value. This value isnull
until joinRoom or createRoom operation is successful. After that, a pointer to the created/joined room object is auto-assigned to this variable. (documentation)
-
onSuccess(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.
-
-
onFailure(error: HBError): void
Called when Joining a room failed.
Parameters:
-
error: HBError
: The error that caused the failure. (documentation)
Return value: void.
-
-
onLeave(msg: HBError): void
Triggered while leaving the room.
Parameters:
-
msg: HBError
: The reason of leaving the room. (documentation)
Return value: void.
-
-
onConnectionStateChange(state: ConnectionState, sdp: string|undefined): void
Triggered when the connection's state changed.
Parameters:
-
state: ConnectionState
: The new connection state. (documentation) -
sdp: string|undefined
: The session description value for webrtc connection. (only exists ifstate
isConnectingToPeer
orAwaitingState
.)
Return value: void.
-
-
onReverseConnection(): void
Triggered while starting to try the reverse connection method while joining a room.
Parameters: None.
Return value: void.
-
onRequestRecaptcha(): void
Triggered when recaptcha is requested from the backend server while joining or creating a room.
Parameters: None.
Return value: void.
-
cancel(): void
This function cancels the process of joining a room. Does nothing if not currently trying to join a room.
Parameters: None.
Return value: void.
-
useRecaptchaToken(token: string): void
Should be used to send the recaptcha token after
onRequestRecaptcha
callback is called. Currently only working while creating a room. Workaround: In order to send the token to try and join a recaptcha-protected room, clean up old resources and useRoom.join
with the new token.Parameters:
-
token: string
: The recaptcha token.
Return value: void.
-