@epicgames-ps/lib-pixelstreamingcommon-ue5.5 / Transport/WebSocketTransportNJS / WebSocketTransportNJS
Transport/WebSocketTransportNJS.WebSocketTransportNJS
An implementation of WebSocketTransport from pixelstreamingcommon that supports node.js websockets This is needed because of the slight differences between the 'ws' node.js package and the websockets supported in the browsers. Do not use this code in a browser use 'WebSocketTransport' instead.
-
EventEmitter
↳
WebSocketTransportNJS
- close
- connect
- disconnect
- handleOnClose
- handleOnError
- handleOnMessage
- handleOnOpen
- isConnected
- sendMessage
• new WebSocketTransportNJS(existingSocket?
): WebSocketTransportNJS
Name | Type |
---|---|
existingSocket? |
WebSocket |
EventEmitter.constructor
Transport/WebSocketTransportNJS.ts:18
• WS_OPEN_STATE: number
= 1
Transport/WebSocketTransportNJS.ts:15
• Optional
onMessage: (msg
: BaseMessage
) => void
Callback filled in by the SignallingProtocol and should be called by the transport when a new message arrives.
▸ (msg
): void
Name | Type |
---|---|
msg |
BaseMessage |
void
Transport/WebSocketTransportNJS.ts:38
• Optional
webSocket: WebSocket
Transport/WebSocketTransportNJS.ts:16
▸ close(): void
Closes the Websocket connection
void
Transport/WebSocketTransportNJS.ts:114
▸ connect(connectionURL
): boolean
Connect to the signaling server
Name | Type | Description |
---|---|---|
connectionURL |
string |
The Address of the signaling server |
boolean
If there is a connection
Transport/WebSocketTransportNJS.ts:45
▸ disconnect(code?
, reason?
): void
Disconnect this transport.
Name | Type | Description |
---|---|---|
code? |
number |
An optional disconnect code. |
reason? |
string |
A descriptive string for the disconnect reason. |
void
Transport/WebSocketTransportNJS.ts:56
▸ handleOnClose(event
): void
Handles when the Websocket is closed
Name | Type | Description |
---|---|---|
event |
CloseEvent |
Close Event |
void
Transport/WebSocketTransportNJS.ts:107
▸ handleOnError(event
): void
Handles when there is an error on the websocket
Name | Type | Description |
---|---|---|
event |
ErrorEvent |
Error Payload |
void
Transport/WebSocketTransportNJS.ts:99
▸ handleOnMessage(event
): void
Handles what happens when a message is received
Name | Type | Description |
---|---|---|
event |
MessageEvent |
Message Received |
void
Transport/WebSocketTransportNJS.ts:74
▸ handleOnOpen(event
): void
Handles when the Websocket is opened
Name | Type | Description |
---|---|---|
event |
Event |
Not Used |
void
Transport/WebSocketTransportNJS.ts:91
▸ isConnected(): boolean
Should return true when the transport is connected and ready to send/receive messages.
boolean
True if the transport is connected.
Transport/WebSocketTransportNJS.ts:66
▸ sendMessage(msg
): void
Sends a message over the websocket.
Name | Type | Description |
---|---|---|
msg |
BaseMessage |
The message to send. |
void