Class
SoupWebsocketConnection
Description [src]
final class Soup.WebsocketConnection : GObject.Object {
/* No available fields */
}
The WebSocket Protocol
Provides support for the WebSocket protocol.
To connect to a WebSocket server, create a SoupSession
and call
soup_session_websocket_connect_async()
. To accept WebSocket
connections, create a SoupServer
and add a handler to it with
soup_server_add_websocket_handler()
.
(Lower-level support is available via
soup_websocket_client_prepare_handshake()
and
soup_websocket_client_verify_handshake()
, for handling the client side of the
WebSocket handshake, and soup_websocket_server_process_handshake()
for
handling the server side.)
SoupWebsocketConnection
handles the details of WebSocket communication. You
can use soup_websocket_connection_send_text()
and
soup_websocket_connection_send_binary()
to send data, and the
SoupWebsocketConnection::message
signal to receive data.
(SoupWebsocketConnection
currently only supports asynchronous I/O.)
Constructors
soup_websocket_connection_new
Creates a SoupWebsocketConnection
on stream
with the given active extensions
.
Instance methods
soup_websocket_connection_get_connection_type
Get the connection type (client/server) of the connection.
soup_websocket_connection_get_keepalive_interval
Gets the keepalive interval in seconds or 0 if disabled.
soup_websocket_connection_get_keepalive_pong_timeout
Gets the keepalive pong timeout in seconds or 0 if disabled.
since: 3.6
soup_websocket_connection_get_max_incoming_payload_size
Gets the maximum payload size allowed for incoming packets.
soup_websocket_connection_send_message
Send a message of the given type
to the peer. Note that this method,
allows to send text messages containing NULL
characters.
soup_websocket_connection_set_keepalive_interval
Sets the interval in seconds on when to send a ping message which will serve as a keepalive message.
soup_websocket_connection_set_keepalive_pong_timeout
Set the timeout in seconds for when the absence of a pong from a keepalive ping is assumed to be caused by a faulty connection.
since: 3.6
soup_websocket_connection_set_max_incoming_payload_size
Sets the maximum payload size allowed for incoming packets.
Properties
Soup.WebsocketConnection:extensions
List of SoupWebsocketExtension
objects that are active in the connection.
Soup.WebsocketConnection:keepalive-interval
Interval in seconds on when to send a ping message which will serve as a keepalive message.
Soup.WebsocketConnection:keepalive-pong-timeout
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.
since: 3.6
Signals
Soup.WebsocketConnection::pong
Emitted when we receive a Pong frame (solicited or unsolicited) from the peer.
Signals inherited from GObject (1)
GObject::notify
The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.
Class structure
struct SoupWebsocketConnectionClass {
GObjectClass parent_class;
}
The abstract base class for SoupWebsocketConnection
.
Class members
parent_class: GObjectClass
- No description available.