WebsocketConnection

A class representing a WebSocket connection.

Constructors

this
this(SoupWebsocketConnection* soupWebsocketConnection, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(IOStream stream, URI uri, SoupWebsocketConnectionType type, string origin, string protocol)

Creates a #SoupWebsocketConnection on @stream. This should be called after completing the handshake to begin using the WebSocket protocol.

this
this(IOStream stream, URI uri, SoupWebsocketConnectionType type, string origin, string protocol, ListG extensions)

Creates a #SoupWebsocketConnection on @stream with the given active @extensions. This should be called after completing the handshake to begin using the WebSocket protocol.

Members

Functions

addOnClosed
gulong addOnClosed(void delegate(WebsocketConnection) dlg, ConnectFlags connectFlags)

Emitted when the connection has completely closed, either due to an orderly close from the peer, one initiated via soup_websocket_connection_close() or a fatal error condition that caused a close.

addOnClosing
gulong addOnClosing(void delegate(WebsocketConnection) dlg, ConnectFlags connectFlags)

This signal will be emitted during an orderly close.

addOnError
gulong addOnError(void delegate(ErrorG, WebsocketConnection) dlg, ConnectFlags connectFlags)

Emitted when an error occurred on the WebSocket. This may be fired multiple times. Fatal errors will be followed by the #SoupWebsocketConnection::closed signal being emitted.

addOnMessage
gulong addOnMessage(void delegate(int, Bytes, WebsocketConnection) dlg, ConnectFlags connectFlags)

Emitted when we receive a message from the peer.

addOnPong
gulong addOnPong(void delegate(Bytes, WebsocketConnection) dlg, ConnectFlags connectFlags)

Emitted when we receive a Pong frame (solicited or unsolicited) from the peer.

close
void close(ushort code, string data)

Close the connection in an orderly fashion.

getCloseCode
ushort getCloseCode()

Get the close code received from the WebSocket peer.

getCloseData
string getCloseData()

Get the close data received from the WebSocket peer.

getConnectionType
SoupWebsocketConnectionType getConnectionType()

Get the connection type (client/server) of the connection.

getExtensions
ListG getExtensions()

Get the extensions chosen via negotiation with the peer.

getIoStream
IOStream getIoStream()

Get the I/O stream the WebSocket is communicating over.

getKeepaliveInterval
uint getKeepaliveInterval()

Gets the keepalive interval in seconds or 0 if disabled.

getMaxIncomingPayloadSize
ulong getMaxIncomingPayloadSize()

Gets the maximum payload size allowed for incoming packets.

getOrigin
string getOrigin()

Get the origin of the WebSocket.

getProtocol
string getProtocol()

Get the protocol chosen via negotiation with the peer.

getState
SoupWebsocketState getState()

Get the current state of the WebSocket.

getStruct
void* getStruct()

the main Gtk struct as a void*

getUri
URI getUri()

Get the URI of the WebSocket.

getWebsocketConnectionStruct
SoupWebsocketConnection* getWebsocketConnectionStruct(bool transferOwnership)

Get the main Gtk struct

sendBinary
void sendBinary(ubyte[] data)

Send a binary message to the peer. If @length is 0, @data may be %NULL.

sendMessage
void sendMessage(SoupWebsocketDataType type, Bytes message)

Send a message of the given @type to the peer. Note that this method, allows to send text messages containing %NULL characters.

sendText
void sendText(string text)

Send a %NULL-terminated text (UTF-8) message to the peer. If you need to send text messages containing %NULL characters use soup_websocket_connection_send_message() instead.

setKeepaliveInterval
void setKeepaliveInterval(uint interval)

Sets the interval in seconds on when to send a ping message which will serve as a keepalive message. If set to 0 the keepalive message is disabled.

setMaxIncomingPayloadSize
void setMaxIncomingPayloadSize(ulong maxIncomingPayloadSize)

Sets the maximum payload size allowed for incoming packets. It does not limit the outgoing packet size.

Static functions

getType
GType getType()

Variables

soupWebsocketConnection
SoupWebsocketConnection* soupWebsocketConnection;

the main Gtk struct

Meta

Since

2.50