WebsocketConnection
The WebSocket Protocol
Provides support for the WebSocket protocol.
To connect to a WebSocket server, create a class@Session and call method@Session.websocket_connect_async. To accept WebSocket connections, create a class@Server and add a handler to it with method@Server.add_websocket_handler.
(Lower-level support is available via func@websocket_client_prepare_handshake and func@websocket_client_verify_handshake, for handling the client side of the WebSocket handshake, and func@websocket_server_process_handshake for handling the server side.)
#SoupWebsocketConnection handles the details of WebSocket communication. You can use method@WebsocketConnection.send_text and method@WebsocketConnection.send_binary to send data, and the signal@WebsocketConnection::message signal to receive data. (#SoupWebsocketConnection currently only supports asynchronous I/O.)
Skipped during bindings generation
parameter
code
: gushortmethod
get_close_code
: Return type gushort is unsupportedparameter
data
: Array parameter of type guint8 is not supported
Constructors
Creates a #SoupWebsocketConnection on @stream with the given active @extensions.
Properties
The type of connection (client/server).
List of class@WebsocketExtension objects that are active in the connection.
Interval in seconds on when to send a ping message which will serve as a keepalive message.
Timeout in seconds for when the absence of a pong from a keepalive ping is assumed to be caused by a faulty connection. The WebSocket will be transitioned to a closed state when this happens.
The maximum payload size for incoming packets.
The current state of the WebSocket.
Functions
Emitted when the connection has completely closed.
This signal will be emitted during an orderly close.
Emitted when an error occurred on the WebSocket.
Emitted when we receive a message from the peer.
Emitted when we receive a Pong frame (solicited or unsolicited) from the peer.
Get the close data received from the WebSocket peer.
Send a message of the given @type to the peer. Note that this method, allows to send text messages containing null characters.