WebSocketServer

A WebSocket server implementation

This class implements a WebSocket server that can also support the high level multiplayer API. After starting the server (listen), you will need to NetworkedMultiplayerPeer.poll it at regular intervals (e.g. inside Node._process). When clients connect, disconnect, or send data, you will receive the appropriate signal. Note: This class will not work in HTML5 exports due to browser restrictions.

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Functions

disconnectPeer
void disconnectPeer(long id, long code, StringArg2 reason)

Disconnects the peer identified by id from the server. See WebSocketPeer.close for more info.

getPeerAddress
String getPeerAddress(long id)

Returns the IP address of the given peer.

getPeerPort
long getPeerPort(long id)

Returns the remote port of the given peer.

hasPeer
bool hasPeer(long id)

Returns true if a peer with the given ID is connected.

isListening
bool isListening()

Returns true if the server is actively listening on a port.

listen
GodotError listen(long port, PoolStringArray protocols, bool gd_mp_api)

Start listening on the given port. You can specify the desired subprotocols via the "protocols" array. If the list empty (default), "binary" will be used. You can use this server as a network peer for MultiplayerAPI by passing true as gd_mp_api. Note: dataReceived will not be fired and clients other than Godot will not work in this case.

opAssign
WebSocketServer opAssign(T n)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(WebSocketServer other)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(typeof(null) n)
Undocumented in source. Be warned that the author may not have intended to support it.
stop
void stop()

Stop the server and clear its state.

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Static functions

_new
WebSocketServer _new()
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

_classBinding
struct _classBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
To as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
ToRef as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta