Page:
ModuleServerAPILibsWebSocketLib
Pages
Config
ContactDetails
GetiyoModuleTool
Home
ModuleAPIGameLibEndScreen
ModuleAPIGameLibRatio
ModuleApiGameLibFrameCycle
ModuleApiGameLibGameDetails
ModuleApiGameLibRuntimeStorage
ModuleApiGameLibTimeSpan
ModuleClientAPI
ModuleClientAPIFeedback
ModuleClientAPIGameLib
ModuleClientAPIGameLibController
ModuleClientAPIIntroduction
ModuleClientAPINeighbor
ModuleClientAPINeighborResults
ModuleClientAPIPrincipals
ModuleClientAPIProperty
ModuleClientAPIUser
ModuleConfigCondition
ModuleConfigProperty
ModuleConfigTrigger
ModuleDebugging
ModuleDevelopmentIntroduction
ModuleEnvironment
ModuleJSON
ModuleServerAPI
ModuleServerAPIClient
ModuleServerAPIData
ModuleServerAPIDatabase
ModuleServerAPIGameLib
ModuleServerAPIGameLibCollisionSpace
ModuleServerAPIGameLibGame
ModuleServerAPIGameLibGamePlayer
ModuleServerAPIGameLibIntroduction
ModuleServerAPIGameLibRoom
ModuleServerAPIGameLibScoreboard
ModuleServerAPIGameLibScoreboardDetails
ModuleServerAPIGameLibScoreboardState
ModuleServerAPIIntroduction
ModuleServerAPILibs
ModuleServerAPILibsWebSocketLib
ModuleServerAPILibsWebSocketLibClient
ModuleServerAPIPrincipals
ModuleServerAPIProperty
ModuleStore
ModuleTS
Prerequisites
Reporting
ServerSetup
V1ModuleStructure
V2ModuleStructure
WebSocketLibCommuncationStandard
Clone
1
ModuleServerAPILibsWebSocketLib
Mees van der Wijk edited this page 2023-04-05 12:21:02 +02:00
ModuleServerAPI LibWebSocket
Class representing the ModuleServerAPI LibWebSocket.
Functions
on
Register a listener for messages from a LibWebSocketClient.
api.Libs.getWebSocket().on(header, callback);
| Argument | Type | Description |
|---|---|---|
| header | string | To header of the messages the listener will receive. |
| callback | ( client:LibWebSocketClient, ...args:any[] ):void | Function that receives the incomming message and arguments. |
onClientConnect
Assigns an event to be triggered when a new LibWebSocketClient connects.
api.Libs.getWebSocket().onClientConnect(callback);
| Argument | Type | Description |
|---|---|---|
| callback | ( client:LibWebSocketClient ):void | Function will be called when a new LibWebSocketClient connects. |
onClientDisconnect
Assigns an event to be triggered when a LibWebSocketClient disconnects.
api.Libs.getWebSocket().onClientDisconnect(callback);
| Argument | Type | Description |
|---|---|---|
| callback | ( socketId:string ):void | Function will be called when a LibWebSocketClient disconnects. |
getClients
Get the connected LibWebSocketClients.
api.Libs.getWebSocket().getClient(socketId);
| Argument | Type | Description |
|---|---|---|
| socketId | string | The id of the socket client. |
Return LibWebSocketClient Socket client
getClient
Get a specific LibWebSocketClient.
api.Libs.getWebSocket().getClient(socketId);
| Argument | Type | Description |
|---|---|---|
| socketId | string | The id of the socket client. |
Return LibWebSocketClient Socket client
broadcast
Broadcasts a message to all connected LibWebSocketClients.
api.Libs.getWebSocket().broadcast(header, ...args);
| Argument | Type | Description |
|---|---|---|
| header | string | The header of the message. |
| args | any[] | Data of any type. |
rawBroadcast
Broadcasts a raw message to all connected LibWebSocketClients.
api.Libs.getWebSocket().rawBroadcast(data);
| Argument | Type | Description | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| data | string | Buffer | DataView | number | ArrayBufferView | Uint8Array | ArrayBuffer | SharedArrayBuffer | ReadonlyArray | ReadonlyArray | { valueOf(): ArrayBuffer } | { valueOf(): SharedArrayBuffer } | { valueOf(): Uint8Array } | { valueOf(): ReadonlyArray } | { valueOf(): string } | { [Symbol.toPrimitive](hint: string): string }; | The data of the message. |
Getting Started
Module Development
- Introduction
- V2 Module Structure
- V1 Module Structure
- Development environment/Building
- Module Config
- Module Debugging
- GetiyoModuleTool
- Bug/Feature Reporting
- Contact Details
ModuleServerAPI
ModuleServerAPI GameLib
ModuleClientAPI
ModuleApi Shared
© Vix Entertainment 2023 - © Mooren Productief 2023 - All rights reserved