network-client API
TCPClient
connect()
Initiate a WebSocket connection to the server, for examplews://<ip>:<port>.
Returns: Promise<void>
isConnected()
Returntrue when the underlying WebSocket is open.
Returns: boolean
sendData(data)
Send a payload to the server. Parameterdata: Uint8Array raw payload bytes.
Returns: void
getReceivedPackets()
Return an array of complete packets that were reassembled from received chunks. Returns:Uint8Array[]
UDPClient
connect()
Open a WebSocket for signaling, create anRTCPeerConnection, and initiate an SDP offer.
Returns: Promise<void>
isConnected()
Returntrue when the RTCDataChannel is open.
Returns: boolean
sendData(data)
Send a payload on the data channel. Parameterdata: Uint8Array raw payload bytes.
Returns: void
getReceivedPackets()
Return an array of complete packets reassembled from received data-channel chunks. Returns:Uint8Array[]