A class representing a specific WebSocket connection.
|void||close ( int code=1000, String reason=”” )|
|String||get_connected_host ( ) const|
|int||get_connected_port ( ) const|
|WriteMode||get_write_mode ( ) const|
|bool||is_connected_to_host ( ) const|
|void||set_write_mode ( WriteMode mode )|
|bool||was_string_packet ( ) const|
- WRITE_MODE_TEXT = 0 — Specify that WebSockets messages should be transferred as text payload (only valid UTF-8 is allowed).
- WRITE_MODE_BINARY = 1 — Specify that WebSockets messages should be transferred as binary payload (any byte combination is allowed).
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.
Close this WebSocket connection.
code is the status code for the closure (see RFC6455 section 7.4 for a list of valid status codes).
reason is the human readable reason for closing the connection (can be any UTF8 string, must be less than 123 bytes).
Note: HTML5 export might not support all status codes. Please refer to browsers-specific documentation for more details.
- String get_connected_host ( ) const
Returns the IP Address of the connected peer. (Not available in HTML5 export)
- int get_connected_port ( ) const
Returns the remote port of the connected peer. (Not available in HTML5 export)
- WriteMode get_write_mode ( ) const
Get the current selected write mode. See WriteMode.
- bool is_connected_to_host ( ) const
true if this peer is currently connected.
- void set_write_mode ( WriteMode mode )
Sets the socket to use the given WriteMode.
- bool was_string_packet ( ) const
true if the last received packet was sent as a text payload. See WriteMode