gi-soup-2.4.11: Libsoup bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Soup.Objects.WebsocketConnection

Contents

Description

A class representing a WebSocket connection.

Synopsis

Exported types

Methods

close

websocketConnectionClose Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> Word16

code: close code

-> Maybe Text

data: close data

-> m () 

Close the connection in an orderly fashion.

Note that until the WebsocketConnection::closed signal fires, the connection is not yet completely closed. The close message is not even sent until the main loop runs.

The code and data are sent to the peer along with the close request. Note that the data must be UTF-8 valid.

Since: 2.50

getCloseCode

websocketConnectionGetCloseCode Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m Word16

Returns: the close code or zero.

Get the close code received from the WebSocket peer.

This only becomes valid once the WebSocket is in the WebsocketStateClosed state. The value will often be in the WebsocketCloseCode enumeration, but may also be an application defined close code.

Since: 2.50

getCloseData

websocketConnectionGetCloseData Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m Text

Returns: the close data or Nothing

Get the close data received from the WebSocket peer.

This only becomes valid once the WebSocket is in the WebsocketStateClosed state. The data may be freed once the main loop is run, so copy it if you need to keep it around.

Since: 2.50

getConnectionType

websocketConnectionGetConnectionType Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m WebsocketConnectionType

Returns: the connection type

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

Since: 2.50

getIoStream

websocketConnectionGetIoStream Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m IOStream

Returns: the WebSocket's I/O stream.

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

Since: 2.50

getMaxIncomingPayloadSize

websocketConnectionGetMaxIncomingPayloadSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m Word64

Returns: the maximum payload size.

Gets the maximum payload size allowed for incoming packets.

Since: 2.56

getOrigin

websocketConnectionGetOrigin Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m (Maybe Text)

Returns: the origin, or Nothing

Get the origin of the WebSocket.

Since: 2.50

getProtocol

websocketConnectionGetProtocol Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m (Maybe Text)

Returns: the chosen protocol, or Nothing

Get the protocol chosen via negotiation with the peer.

Since: 2.50

getState

websocketConnectionGetState Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m WebsocketState

Returns: the state

Get the current state of the WebSocket.

Since: 2.50

getUri

websocketConnectionGetUri Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> m URI

Returns: the URI

Get the URI of the WebSocket.

For servers this represents the address of the WebSocket, and for clients it is the address connected to.

Since: 2.50

new

websocketConnectionNew Source #

Arguments

:: (HasCallStack, MonadIO m, IsIOStream a) 
=> a

stream: a IOStream connected to the WebSocket server

-> URI

uri: the URI of the connection

-> WebsocketConnectionType

type: the type of connection (client/side)

-> Maybe Text

origin: the Origin of the client

-> Maybe Text

protocol: the subprotocol in use

-> m WebsocketConnection

Returns: a new WebsocketConnection

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

Since: 2.50

sendBinary

websocketConnectionSendBinary Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> ByteString

data: the message contents

-> m () 

Send a binary message to the peer.

The message is queued to be sent and will be sent when the main loop is run.

Since: 2.50

sendText

websocketConnectionSendText Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> Text

text: the message contents

-> m () 

Send a text (UTF-8) message to the peer.

The message is queued to be sent and will be sent when the main loop is run.

Since: 2.50

setMaxIncomingPayloadSize

websocketConnectionSetMaxIncomingPayloadSize Source #

Arguments

:: (HasCallStack, MonadIO m, IsWebsocketConnection a) 
=> a

self: the WebSocket

-> Word64

maxIncomingPayloadSize: the maximum payload size

-> m () 

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

Since: 2.56

Properties

connectionType

data WebsocketConnectionConnectionTypePropertyInfo Source #

Instances

AttrInfo WebsocketConnectionConnectionTypePropertyInfo Source # 
type AttrOrigin WebsocketConnectionConnectionTypePropertyInfo Source # 
type AttrLabel WebsocketConnectionConnectionTypePropertyInfo Source # 
type AttrGetType WebsocketConnectionConnectionTypePropertyInfo Source # 
type AttrBaseTypeConstraint WebsocketConnectionConnectionTypePropertyInfo Source # 
type AttrSetTypeConstraint WebsocketConnectionConnectionTypePropertyInfo Source # 
type AttrAllowedOps WebsocketConnectionConnectionTypePropertyInfo Source # 

ioStream

data WebsocketConnectionIoStreamPropertyInfo Source #

Instances

AttrInfo WebsocketConnectionIoStreamPropertyInfo Source # 
type AttrOrigin WebsocketConnectionIoStreamPropertyInfo Source # 
type AttrLabel WebsocketConnectionIoStreamPropertyInfo Source # 
type AttrGetType WebsocketConnectionIoStreamPropertyInfo Source # 
type AttrBaseTypeConstraint WebsocketConnectionIoStreamPropertyInfo Source # 
type AttrSetTypeConstraint WebsocketConnectionIoStreamPropertyInfo Source # 
type AttrAllowedOps WebsocketConnectionIoStreamPropertyInfo Source # 

maxIncomingPayloadSize

data WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source #

Instances

AttrInfo WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source # 
type AttrOrigin WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source # 
type AttrLabel WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source # 
type AttrGetType WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source # 
type AttrBaseTypeConstraint WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source # 
type AttrSetTypeConstraint WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source # 
type AttrAllowedOps WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source # 

origin

data WebsocketConnectionOriginPropertyInfo Source #

Instances

AttrInfo WebsocketConnectionOriginPropertyInfo Source # 
type AttrOrigin WebsocketConnectionOriginPropertyInfo Source # 
type AttrLabel WebsocketConnectionOriginPropertyInfo Source # 
type AttrGetType WebsocketConnectionOriginPropertyInfo Source # 
type AttrBaseTypeConstraint WebsocketConnectionOriginPropertyInfo Source # 
type AttrSetTypeConstraint WebsocketConnectionOriginPropertyInfo Source # 
type AttrAllowedOps WebsocketConnectionOriginPropertyInfo Source # 

protocol

data WebsocketConnectionProtocolPropertyInfo Source #

Instances

AttrInfo WebsocketConnectionProtocolPropertyInfo Source # 
type AttrOrigin WebsocketConnectionProtocolPropertyInfo Source # 
type AttrLabel WebsocketConnectionProtocolPropertyInfo Source # 
type AttrGetType WebsocketConnectionProtocolPropertyInfo Source # 
type AttrBaseTypeConstraint WebsocketConnectionProtocolPropertyInfo Source # 
type AttrSetTypeConstraint WebsocketConnectionProtocolPropertyInfo Source # 
type AttrAllowedOps WebsocketConnectionProtocolPropertyInfo Source # 

state

data WebsocketConnectionStatePropertyInfo Source #

Instances

AttrInfo WebsocketConnectionStatePropertyInfo Source # 
type AttrOrigin WebsocketConnectionStatePropertyInfo Source # 
type AttrLabel WebsocketConnectionStatePropertyInfo Source # 
type AttrGetType WebsocketConnectionStatePropertyInfo Source # 
type AttrBaseTypeConstraint WebsocketConnectionStatePropertyInfo Source # 
type AttrSetTypeConstraint WebsocketConnectionStatePropertyInfo Source # 
type AttrAllowedOps WebsocketConnectionStatePropertyInfo Source # 

uri

data WebsocketConnectionUriPropertyInfo Source #

Instances

AttrInfo WebsocketConnectionUriPropertyInfo Source # 
type AttrOrigin WebsocketConnectionUriPropertyInfo Source # 
type AttrLabel WebsocketConnectionUriPropertyInfo Source # 
type AttrGetType WebsocketConnectionUriPropertyInfo Source # 
type AttrBaseTypeConstraint WebsocketConnectionUriPropertyInfo Source # 
type AttrSetTypeConstraint WebsocketConnectionUriPropertyInfo Source # 
type AttrAllowedOps WebsocketConnectionUriPropertyInfo Source # 

Signals

closed

closing

error

message