A class representing a specific WebSocket connection.
This class represents a specific WebSocket connection, allowing you to 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.
Closes this WebSocket connection. [code]code[/code] is the status code for the closure (see RFC 6455 section 7.4 for a list of valid status codes). [code]reason[/code] is the human readable reason for closing the connection (can be any UTF-8 string that's smaller than 123 bytes).
[b]Note:[/b] To achieve a clean close, you will need to keep polling until either [signal WebSocketClient.connection_closed] or [signal WebSocketServer.client_disconnected] is received.
[b]Note:[/b] The Web export might not support all status codes. Please refer to browser-specific documentation for more details.
Returns the IP address of the connected peer.
[b]Note:[/b] Not available in the Web export.
Returns the remote port of the connected peer.
[b]Note:[/b] Not available in the Web export.
Returns the current amount of data in the outbound websocket buffer. [b]Note:[/b] Web exports use WebSocket.bufferedAmount, while other platforms use an internal buffer.
Gets the current selected write mode. See [enum WriteMode].
Returns [code]true[/code] if this peer is currently connected.
Disable Nagle's algorithm on the underling TCP socket (default). See [method StreamPeerTCP.set_no_delay] for more information.
[b]Note:[/b] Not available in the Web export.
Sets the socket to use the given [enum WriteMode].
Returns [code]true[/code] if the last received packet was sent as a text payload. See [enum WriteMode].
Specifies that WebSockets messages should be transferred as text payload (only valid UTF-8 is allowed).
Specifies that WebSockets messages should be transferred as binary payload (any byte combination is allowed).