Class: WebSocketNetworkSystemV1
Hierarchy
-
↳ WebSocketNetworkSystemV1
Table of contents
Constructors
Properties
- messageBus
- scene
- subscriberID
- CONNECTION_ESTABLISHED
- DISCONNECTED
- MESSAGE_UPDATE
- REQUEST_CONNECT
- REQUEST_GRANT_HOST
- REQUEST_KICK
- REQUEST_LIST
- REQUEST_RECONNECT
- REQUEST_RELAY_MESSAGE
- RESPONSE_ASSIGN_HOST
- RESPONSE_BEGIN_HOST_MIGRATE
- RESPONSE_CLIENT_CONNECT
- RESPONSE_CLIENT_DISCONNECT
- RESPONSE_CONNECT
- RESPONSE_ERROR
- RESPONSE_FINISH_HOST_MIGRATE
- RESPONSE_KICK
- RESPONSE_LIST
- RESPONSE_RELAY_MESSAGE
- SET_PROTOCOLS
- SET_URL
Methods
Constructors
constructor
+ new WebSocketNetworkSystemV1(messageBus: IMessageBus, url?: string, protocols?: string | string[], scene?: IScene, tickRate?: number, subscriberID?: number, pageWindow?: Window): WebSocketNetworkSystemV1
Parameters:
| Name | Type |
|---|---|
messageBus |
IMessageBus |
url? |
string |
protocols? |
string | string[] |
scene? |
IScene |
tickRate |
number |
subscriberID? |
number |
pageWindow |
Window |
Returns: WebSocketNetworkSystemV1
Inherited from: System
Properties
messageBus
• Protected messageBus: IMessageBus
Reference to the message bus, the fundamental piece of JamJar for communicating with other parts of the engine.
Inherited from: System.messageBus
scene
• Protected Optional scene: undefined | IScene
Any scene this system is part of, will change the lifecycle of the system to be part of the scene's lifecycle - it will be destroyed when the scene is destroyed.
subscriberID
• subscriberID: number
Inherited from: System.subscriberID
CONNECTION_ESTABLISHED
▪ Readonly Static CONNECTION_ESTABLISHED: jamjar_websocket_connection_established= "jamjar_websocket_connection_established"
DISCONNECTED
▪ Readonly Static DISCONNECTED: jamjar_websocket_disconnected= "jamjar_websocket_disconnected"
MESSAGE_UPDATE
▪ Readonly Static MESSAGE_UPDATE: system_update= "system_update"
Inherited from: System.MESSAGE_UPDATE
REQUEST_CONNECT
▪ Readonly Static REQUEST_CONNECT: jamjar_websocket_request_connect= "jamjar_websocket_request_connect"
REQUEST_GRANT_HOST
▪ Readonly Static REQUEST_GRANT_HOST: jamjar_websocket_request_grant_host= "jamjar_websocket_request_grant_host"
REQUEST_KICK
▪ Readonly Static REQUEST_KICK: jamjar_websocket_request_kick= "jamjar_websocket_request_kick"
REQUEST_LIST
▪ Readonly Static REQUEST_LIST: jamjar_websocket_request_list= "jamjar_websocket_request_list"
REQUEST_RECONNECT
▪ Readonly Static REQUEST_RECONNECT: jamjar_websocket_request_reconnect= "jamjar_websocket_request_reconnect"
REQUEST_RELAY_MESSAGE
▪ Readonly Static REQUEST_RELAY_MESSAGE: jamjar_websocket_request_relay_message= "jamjar_websocket_request_relay_message"
RESPONSE_ASSIGN_HOST
▪ Readonly Static RESPONSE_ASSIGN_HOST: jamjar_websocket_response_assign_host= "jamjar_websocket_response_assign_host"
RESPONSE_BEGIN_HOST_MIGRATE
▪ Readonly Static RESPONSE_BEGIN_HOST_MIGRATE: jamjar_websocket_response_begin_host_migrate= "jamjar_websocket_response_begin_host_migrate"
RESPONSE_CLIENT_CONNECT
▪ Readonly Static RESPONSE_CLIENT_CONNECT: jamjar_websocket_response_client_connect= "jamjar_websocket_response_client_connect"
RESPONSE_CLIENT_DISCONNECT
▪ Readonly Static RESPONSE_CLIENT_DISCONNECT: jamjar_websocket_response_client_disconnect= "jamjar_websocket_response_client_disconnect"
RESPONSE_CONNECT
▪ Readonly Static RESPONSE_CONNECT: jamjar_websocket_response_connect= "jamjar_websocket_response_connect"
RESPONSE_ERROR
▪ Readonly Static RESPONSE_ERROR: jamjar_websocket_response_error= "jamjar_websocket_response_error"
RESPONSE_FINISH_HOST_MIGRATE
▪ Readonly Static RESPONSE_FINISH_HOST_MIGRATE: jamjar_websocket_response_finish_host_migrate= "jamjar_websocket_response_finish_host_migrate"
RESPONSE_KICK
▪ Readonly Static RESPONSE_KICK: jamjar_websocket_response_kick= "jamjar_websocket_response_kick"
RESPONSE_LIST
▪ Readonly Static RESPONSE_LIST: jamjar_websocket_response_list= "jamjar_websocket_response_list"
RESPONSE_RELAY_MESSAGE
▪ Readonly Static RESPONSE_RELAY_MESSAGE: jamjar_websocket_response_relay_message= "jamjar_websocket_response_relay_message"
SET_PROTOCOLS
▪ Readonly Static SET_PROTOCOLS: jamjar_websocket_set_protocols= "jamjar_websocket_set_protocols"
SET_URL
▪ Readonly Static SET_URL: jamjar_websocket_set_url= "jamjar_websocket_set_url"
Methods
Destroy
▸ Destroy(): void
Destroy destroys the System and unsubscribes it from all messages. The System should be garbage collected after this, unless a direct reference to it exists somewhere. Therefore direct references to systems are discouraged; communication should all be through the message bus.
Returns: void
Inherited from: System
OnDestroy
▸ ProtectedOnDestroy(): void
Custom Destroy logic should go here to facilitate garbage collection, for example removing listeners.
Returns: void
Inherited from: System
OnMessage
▸ OnMessage(message: IMessage): void
Parameters:
| Name | Type |
|---|---|
message |
IMessage |
Returns: void
Overrides: System
Update
▸ Update(deltaTime: number): void
Parameters:
| Name | Type |
|---|---|
deltaTime |
number |
Returns: void
Overrides: System
onClose
▸ ProtectedonClose(event: CloseEvent): void
Parameters:
| Name | Type |
|---|---|
event |
CloseEvent |
Returns: void
onNetworkMessage
▸ ProtectedonNetworkMessage(event: MessageEvent<any>): void
Parameters:
| Name | Type |
|---|---|
event |
MessageEvent<any> |
Returns: void
onOpen
▸ ProtectedonOpen(event: Event): void
Parameters:
| Name | Type |
|---|---|
event |
Event |
Returns: void
onPageClose
▸ ProtectedonPageClose(): void
Returns: void