Skip to main content

UDPClient

Summary

Unreliable, unordered WebRTC data-channel client connection to a NanoForge UDP server.

Signature

Constructors

constructor

Constructs a new instance of the class

Methods

connect

Open the WebSocket signaling channel, create an RTCPeerConnection, and complete the SDP/ICE handshake with the server.

getReceivedPackets

Parse and return all complete packets received since the last call.

isConnected

Return when the RTCDataChannel is open.

sendData

Send a payload on the data channel.

Remarks

Uses a WebSocket signaling channel to perform the SDP/ICE handshake and then communicates over an RTCDataChannel with ordered: false and maxRetransmits: 0 for minimal latency. Typical usage is through NetworkClientLibrary which instantiates and connects this class automatically during __init.