WebSocketPeer

A class representing a specific WebSocket connection.

This class represent a specific WebSocket connection, you can do lower level operations with it. You can choose to write to the socket in binary or text mode, and you can recognize the mode used for writing by the other peer.

Members

Aliases

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

Enums

Constants
enum Constants
WriteMode
enum WriteMode

Functions

close
void close(long code, String reason)

Closes this WebSocket connection. code is the status code for the closure (see RFC 6455 section 7.4 for a list of valid status codes). reason is the human readable reason for closing the connection (can be any UTF-8 string that's smaller than 123 bytes). Note: To achieve a clean close, you will need to keep polling until either WebSocketClient.connectionClosed or WebSocketServer.clientDisconnected is received. Note: The HTML5 export might not support all status codes. Please refer to browser-specific documentation for more details.

getConnectedHost
String getConnectedHost()

Returns the IP address of the connected peer. Note: Not available in the HTML5 export.

getConnectedPort
long getConnectedPort()

Returns the remote port of the connected peer. Note: Not available in the HTML5 export.

getWriteMode
WebSocketPeer.WriteMode getWriteMode()

Gets the current selected write mode. See writemode.

isConnectedToHost
bool isConnectedToHost()

Returns true if this peer is currently connected.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(WebSocketPeer other)
opEquals
bool opEquals(typeof(null) n)
setNoDelay
void setNoDelay(bool enabled)

Disable Nagle's algorithm on the underling TCP socket (default). See StreamPeerTCP.setNoDelay for more information. Note: Not available in the HTML5 export.

setWriteMode
void setWriteMode(long mode)

Sets the socket to use the given writemode.

toHash
size_t toHash()
wasStringPacket
bool wasStringPacket()

Returns true if the last received packet was sent as a text payload. See writemode.

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Static functions

_new
WebSocketPeer _new()

Construct a new instance of WebSocketPeer. Note: use memnew!WebSocketPeer instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
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
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(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