soup.websocket_connection
Module for [WebsocketConnection] class
Types 3
The WebSocket Protocol
Provides support for the WebSocket protocol.
To connect to a WebSocket server, create a soup.session.Session and call soup.session.Session.websocketConnectAsync. To accept WebSocket connections, create a soup.server.Server and add a handler to it with soup.server.Server.addWebsocketHandler.
(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 soup.websocket_connection.WebsocketConnection.sendText and soup.websocket_connection.WebsocketConnection.sendBinary to send data, and the soup.websocket_connection.WebsocketConnection.message signal to receive data. (#SoupWebsocketConnection currently only supports asynchronous I/O.)
WebsocketConnectionGidBuilder builder() static nothrowGet builder for [soup.websocket_connection.WebsocketConnection] Returns: New builder objectsoup.types.WebsocketConnectionType connectionType() @property nothrowGet `connectionType` property. Returns: The type of connection (client/server).void * extensions() @property nothrowGet `extensions` property. Returns: List of [soup.websocket_extension.WebsocketExtension] objects that are active in the connection.gio.iostream.IOStream ioStream() @property nothrowGet `ioStream` property. Returns: The underlying IO stream the WebSocket is communicating over.uint keepaliveInterval() @property nothrowGet `keepaliveInterval` property. Returns: Interval in seconds on when to send a ping message which will serve as a keepalive message.void keepaliveInterval(uint propval) @property nothrowSet `keepaliveInterval` property. Params: propval = Interval in seconds on when to send a ping message which will serve as a keepalive message.ulong maxIncomingPayloadSize() @property nothrowGet `maxIncomingPayloadSize` property. Returns: The maximum payload size for incoming packets.void maxIncomingPayloadSize(ulong propval) @property nothrowSet `maxIncomingPayloadSize` property. Params: propval = The maximum payload size for incoming packets.string protocol() @property nothrowGet `protocol` property. Returns: The chosen protocol, or null if a protocol was not agreed upon.soup.types.WebsocketState state() @property nothrowGet `state` property. Returns: The current state of the WebSocket.soup.types.WebsocketConnectionType getConnectionType() nothrowGet the connection type (client/server) of the connection. Returns: the connection typesoup.websocket_extension.WebsocketExtension[] getExtensions() nothrowGet the extensions chosen via negotiation with the peer. Returns: a #GList of #SoupWebsocketExtension objectsgio.iostream.IOStream getIoStream() nothrowGet the I/O stream the WebSocket is communicating over. Returns: the WebSocket's I/O stream.uint getKeepaliveInterval() nothrowGets the keepalive interval in seconds or 0 if disabled. Returns: the keepalive interval.ulong getMaxIncomingPayloadSize() nothrowGets the maximum payload size allowed for incoming packets. Returns: the maximum payload size.string getProtocol() nothrowGet the protocol chosen via negotiation with the peer. Returns: the chosen protocolsoup.types.WebsocketState getState() nothrowGet the current state of the WebSocket. Returns: the statevoid sendMessage(soup.types.WebsocketDataType type, glib.bytes.Bytes message) nothrowSend a message of the given type to the peer. Note that this method, allows to send text messages containing null characters.void setKeepaliveInterval(uint interval) nothrowSets the interval in seconds on when to send a ping message which will serve as a keepalive message.void setMaxIncomingPayloadSize(ulong maxIncomingPayloadSize) nothrowSets the maximum payload size allowed for incoming packets.gulong connectClosed(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.websocket_connection.WebsocketConnection)))
&& Parameters!T.length < 2) nothrowConnect to `Closed` signal.gulong connectClosing(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : soup.websocket_connection.WebsocketConnection)))
&& Parameters!T.length < 2) nothrowConnect to `Closing` signal.gulong connectError(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == glib.error.ErrorWrap)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : soup.websocket_connection.WebsocketConnection)))
&& Parameters!T.length < 3) nothrowConnect to `Error` signal.gulong connectMessage(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == int)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] == glib.bytes.Bytes)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : soup.websocket_connection.WebsocketConnection)))
&& Parameters!T.length < 4) nothrowConnect to `Message` signal.gulong connectPong(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == void)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] == glib.bytes.Bytes)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : soup.websocket_connection.WebsocketConnection)))
&& Parameters!T.length < 3) nothrowConnect to `Pong` signal.Fluent builder implementation template for soup.websocket_connection.WebsocketConnection
T connectionType(soup.types.WebsocketConnectionType propval) nothrowSet `connectionType` property. Params: propval = The type of connection (client/server). Returns: Builder instance for fluent chainingT extensions(void * propval) nothrowSet `extensions` property. Params: propval = List of [soup.websocket_extension.WebsocketExtension] objects that are active in the connection. Returns: Builder instance for fluent chainingT ioStream(gio.iostream.IOStream propval) nothrowSet `ioStream` property. Params: propval = The underlying IO stream the WebSocket is communicating over.T keepaliveInterval(uint propval) nothrowSet `keepaliveInterval` property. Params: propval = Interval in seconds on when to send a ping message which will serve as a keepalive message.T maxIncomingPayloadSize(ulong propval) nothrowSet `maxIncomingPayloadSize` property. Params: propval = The maximum payload size for incoming packets.T origin(string propval) nothrowSet `origin` property. Params: propval = The client's Origin. Returns: Builder instance for fluent chainingT protocol(string propval) nothrowSet `protocol` property. Params: propval = The chosen protocol, or null if a protocol was not agreed upon. Returns: Builder instance for fluent chainingFluent builder for soup.websocket_connection.WebsocketConnection