WebsocketConnection
Object Hierarchy:
Description:
[
CCode ( type_id =
"soup_websocket_connection_get_type ()" ) ]
[
Version ( since =
"2.50" ) ]
public class WebsocketConnection :
Object
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.)
[class@WebsocketConnection] 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:SoupWebsocketConnection:message]
signal to receive data. ([class@WebsocketConnection] currently only supports asynchronous I/O.)
Content:
Properties:
- public WebsocketConnectionType connection_type { get; construct; }
The type of connection (client/server).
- public void* extensions { get; construct; }
List of [class@WebsocketExtension] objects that are active in the
connection.
- public IOStream io_stream { get; construct; }
The underlying IO stream the WebSocket is communicating over.
- public uint keepalive_interval { get; set construct; }
Interval in seconds on when to send a ping message which will serve as
a keepalive message.
- public uint64 max_incoming_payload_size { get; set construct; }
The maximum payload size for incoming packets.
- public string origin { get; construct; }
The client's Origin.
- public string protocol { get; construct; }
The chosen protocol, or null if a
protocol was not agreed upon.
- public WebsocketState state { get; }
The current state of the WebSocket.
- public URI uri { get; construct; }
The URI of the WebSocket.
Creation methods:
Methods:
Signals:
- public virtual signal void closed ()
Emitted when the connection has completely closed.
- public virtual signal void closing ()
This signal will be emitted during an orderly close.
- public virtual signal void error (Error error)
Emitted when an error occurred on the WebSocket.
- public virtual signal void message (int type, Bytes message)
Emitted when we receive a message from the peer.
- public virtual signal void pong (Bytes message)
Emitted when we receive a Pong frame (solicited or unsolicited) from
the peer.
Inherited Members:
All known members inherited from class GLib.Object