reckfellENGINE

WebSocketMultiplayerPeer

Base class for WebSocket server and client.

On this page
class WebSocketMultiplayerPeerReckfellSharpInherits MultiplayerPeer

Base class for WebSocket server and client.

Base class for WebSocket server and client, allowing them to be used as multiplayer peer for the MultiplayerApi. Note: When exporting to Android, make sure to enable the INTERNET permission in the Android export preset before exporting the project or using remote deploy. Otherwise, network communication of any kind will be blocked by Android.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

WebSocketMultiplayerPeerConstructor
# WebSocketMultiplayerPeer
C#
public WebSocketMultiplayerPeer();

Properties6

HandshakeHeadersProperty
# HandshakeHeaders
C#
public string[] HandshakeHeaders { get; set; }

The extra headers to use during handshake. See WebSocketPeer.HandshakeHeaders for more details.

HandshakeTimeoutProperty
# HandshakeTimeout
C#
public float HandshakeTimeout { get; set; }

The maximum time each peer can stay in a connecting state before being dropped.

InboundBufferSizeProperty
# InboundBufferSize
C#
public int InboundBufferSize { get; set; }

The inbound buffer size for connected peers. See WebSocketPeer.InboundBufferSize for more details.

MaxQueuedPacketsProperty
# MaxQueuedPackets
C#
public int MaxQueuedPackets { get; set; }

The maximum number of queued packets for connected peers. See WebSocketPeer.MaxQueuedPackets for more details.

OutboundBufferSizeProperty
# OutboundBufferSize
C#
public int OutboundBufferSize { get; set; }

The outbound buffer size for connected peers. See WebSocketPeer.OutboundBufferSize for more details.

SupportedProtocolsProperty
# SupportedProtocols
C#
public string[] SupportedProtocols { get; set; }

The supported WebSocket sub-protocols. See WebSocketPeer.SupportedProtocols for more details.

Methods19

CreateClientError
# CreateClient
C#
public Error CreateClient(string url, TlsOptions tlsClientOptions = null);

Starts a new multiplayer client connecting to the given url. TLS certificates will be verified against the hostname when connecting using the wss:// protocol. You can pass the optional tls_client_options parameter to customize the trusted certification authorities, or disable the common name verification. See TlsOptions.Client and TlsOptions.ClientUnsafe. Note: It is recommended to specify the scheme part of the URL, i.e. the url should start with either ws:// or wss://.

Parameters
NameTypeDefault
urlstring—
tlsClientOptionsTlsOptionsnull
Returns Error
CreateServerError
# CreateServer
C#
public Error CreateServer(int port, string bindAddress = "*", TlsOptions tlsServerOptions = null);

Starts a new multiplayer server listening on the given port. You can optionally specify a bind_address, and provide valid tls_server_options to use TLS. See TlsOptions.Server.

Parameters
NameTypeDefault
portint—
bindAddressstring"*"
tlsServerOptionsTlsOptionsnull
Returns Error
GetHandshakeHeadersstring[]
# GetHandshakeHeaders
C#
public string[] GetHandshakeHeaders();
Returns string[]
GetHandshakeTimeoutfloat
# GetHandshakeTimeout
C#
public float GetHandshakeTimeout();
Returns float
GetInboundBufferSizeint
# GetInboundBufferSize
C#
public int GetInboundBufferSize();
Returns int
GetMaxQueuedPacketsint
# GetMaxQueuedPackets
C#
public int GetMaxQueuedPackets();
Returns int
GetOutboundBufferSizeint
# GetOutboundBufferSize
C#
public int GetOutboundBufferSize();
Returns int
GetPeerWebSocketPeer
# GetPeer
C#
public WebSocketPeer GetPeer(int peerId);

Returns the WebSocketPeer associated to the given peer_id.

Parameters
NameTypeDefault
peerIdint—
Returns WebSocketPeer
GetPeerAddressstring
# GetPeerAddress
C#
public string GetPeerAddress(int id);

Returns the IP address of the given peer.

Parameters
NameTypeDefault
idint—
Returns string
GetPeerPortint
# GetPeerPort
C#
public int GetPeerPort(int id);

Returns the remote port of the given peer.

Parameters
NameTypeDefault
idint—
Returns int
GetSupportedProtocolsstring[]
# GetSupportedProtocols
C#
public string[] GetSupportedProtocols();
Returns string[]
SetHandshakeHeaders2 overloads
# SetHandshakeHeaders · 1/2
C#
public void SetHandshakeHeaders(ReadOnlySpan<string> protocols);
Parameters
NameTypeDefault
protocolsReadOnlySpan<string>—
# SetHandshakeHeaders · 2/2
C#
public void SetHandshakeHeaders(string[] protocols);
Parameters
NameTypeDefault
protocolsstring[]—
SetHandshakeTimeoutvoid
# SetHandshakeTimeout
C#
public void SetHandshakeTimeout(float timeout);
Parameters
NameTypeDefault
timeoutfloat—
SetInboundBufferSizevoid
# SetInboundBufferSize
C#
public void SetInboundBufferSize(int bufferSize);
Parameters
NameTypeDefault
bufferSizeint—
SetMaxQueuedPacketsvoid
# SetMaxQueuedPackets
C#
public void SetMaxQueuedPackets(int maxQueuedPackets);
Parameters
NameTypeDefault
maxQueuedPacketsint—
SetOutboundBufferSizevoid
# SetOutboundBufferSize
C#
public void SetOutboundBufferSize(int bufferSize);
Parameters
NameTypeDefault
bufferSizeint—
SetSupportedProtocols2 overloads
# SetSupportedProtocols · 1/2
C#
public void SetSupportedProtocols(ReadOnlySpan<string> protocols);
Parameters
NameTypeDefault
protocolsReadOnlySpan<string>—
# SetSupportedProtocols · 2/2
C#
public void SetSupportedProtocols(string[] protocols);
Parameters
NameTypeDefault
protocolsstring[]—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.