Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A class representing a WebSocket connection.
Since: 2.50
Synopsis
- newtype WebsocketConnection = WebsocketConnection (ManagedPtr WebsocketConnection)
- class (GObject o, IsDescendantOf WebsocketConnection o) => IsWebsocketConnection o
- toWebsocketConnection :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketConnection
- websocketConnectionClose :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> Word16 -> Maybe Text -> m ()
- websocketConnectionGetCloseCode :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m Word16
- websocketConnectionGetCloseData :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m Text
- websocketConnectionGetConnectionType :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m WebsocketConnectionType
- websocketConnectionGetExtensions :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m [WebsocketExtension]
- websocketConnectionGetIoStream :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m IOStream
- websocketConnectionGetKeepaliveInterval :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m Word32
- websocketConnectionGetMaxIncomingPayloadSize :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m Word64
- websocketConnectionGetOrigin :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m (Maybe Text)
- websocketConnectionGetProtocol :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m (Maybe Text)
- websocketConnectionGetState :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m WebsocketState
- websocketConnectionGetUri :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m URI
- websocketConnectionNew :: (HasCallStack, MonadIO m, IsIOStream a) => a -> URI -> WebsocketConnectionType -> Maybe Text -> Maybe Text -> m WebsocketConnection
- websocketConnectionNewWithExtensions :: (HasCallStack, MonadIO m, IsIOStream a, IsWebsocketExtension b) => a -> URI -> WebsocketConnectionType -> Maybe Text -> Maybe Text -> [b] -> m WebsocketConnection
- websocketConnectionSendBinary :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> Maybe ByteString -> m ()
- websocketConnectionSendMessage :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> WebsocketDataType -> Bytes -> m ()
- websocketConnectionSendText :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> Text -> m ()
- websocketConnectionSetKeepaliveInterval :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> Word32 -> m ()
- websocketConnectionSetMaxIncomingPayloadSize :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> Word64 -> m ()
- constructWebsocketConnectionConnectionType :: (IsWebsocketConnection o, MonadIO m) => WebsocketConnectionType -> m (GValueConstruct o)
- getWebsocketConnectionConnectionType :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketConnectionType
- constructWebsocketConnectionExtensions :: (IsWebsocketConnection o, MonadIO m) => Ptr () -> m (GValueConstruct o)
- getWebsocketConnectionExtensions :: (MonadIO m, IsWebsocketConnection o) => o -> m (Ptr ())
- constructWebsocketConnectionIoStream :: (IsWebsocketConnection o, MonadIO m, IsIOStream a) => a -> m (GValueConstruct o)
- getWebsocketConnectionIoStream :: (MonadIO m, IsWebsocketConnection o) => o -> m IOStream
- constructWebsocketConnectionKeepaliveInterval :: (IsWebsocketConnection o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getWebsocketConnectionKeepaliveInterval :: (MonadIO m, IsWebsocketConnection o) => o -> m Word32
- setWebsocketConnectionKeepaliveInterval :: (MonadIO m, IsWebsocketConnection o) => o -> Word32 -> m ()
- constructWebsocketConnectionMaxIncomingPayloadSize :: (IsWebsocketConnection o, MonadIO m) => Word64 -> m (GValueConstruct o)
- getWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> m Word64
- setWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> Word64 -> m ()
- constructWebsocketConnectionOrigin :: (IsWebsocketConnection o, MonadIO m) => Text -> m (GValueConstruct o)
- getWebsocketConnectionOrigin :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe Text)
- constructWebsocketConnectionProtocol :: (IsWebsocketConnection o, MonadIO m) => Text -> m (GValueConstruct o)
- getWebsocketConnectionProtocol :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe Text)
- getWebsocketConnectionState :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketState
- constructWebsocketConnectionUri :: (IsWebsocketConnection o, MonadIO m) => URI -> m (GValueConstruct o)
- getWebsocketConnectionUri :: (MonadIO m, IsWebsocketConnection o) => o -> m URI
- type WebsocketConnectionClosedCallback = IO ()
- afterWebsocketConnectionClosed :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionClosedCallback) -> m SignalHandlerId
- onWebsocketConnectionClosed :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionClosedCallback) -> m SignalHandlerId
- type WebsocketConnectionClosingCallback = IO ()
- afterWebsocketConnectionClosing :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionClosingCallback) -> m SignalHandlerId
- onWebsocketConnectionClosing :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionClosingCallback) -> m SignalHandlerId
- type WebsocketConnectionErrorCallback = GError -> IO ()
- afterWebsocketConnectionError :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionErrorCallback) -> m SignalHandlerId
- onWebsocketConnectionError :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionErrorCallback) -> m SignalHandlerId
- type WebsocketConnectionMessageCallback = Int32 -> Bytes -> IO ()
- afterWebsocketConnectionMessage :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionMessageCallback) -> m SignalHandlerId
- onWebsocketConnectionMessage :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionMessageCallback) -> m SignalHandlerId
- type WebsocketConnectionPongCallback = Bytes -> IO ()
- afterWebsocketConnectionPong :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionPongCallback) -> m SignalHandlerId
- onWebsocketConnectionPong :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionPongCallback) -> m SignalHandlerId
Exported types
newtype WebsocketConnection Source #
Memory-managed wrapper type.
WebsocketConnection (ManagedPtr WebsocketConnection) |
Instances
class (GObject o, IsDescendantOf WebsocketConnection o) => IsWebsocketConnection o Source #
Type class for types which can be safely cast to WebsocketConnection
, for instance with toWebsocketConnection
.
Instances
(GObject o, IsDescendantOf WebsocketConnection o) => IsWebsocketConnection o Source # | |
Defined in GI.Soup.Objects.WebsocketConnection |
toWebsocketConnection :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketConnection Source #
Cast to WebsocketConnection
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, close, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, sendBinary, sendMessage, sendText, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getCloseCode, getCloseData, getConnectionType, getData, getExtensions, getIoStream, getKeepaliveInterval, getMaxIncomingPayloadSize, getOrigin, getProperty, getProtocol, getQdata, getState, getUri.
Setters
setData, setDataFull, setKeepaliveInterval, setMaxIncomingPayloadSize, setProperty.
close
websocketConnectionClose Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> Word16 |
|
-> Maybe Text |
|
-> 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.
If code
is WebsocketCloseCodeNoStatus
a close message with no body
(without code and data) is sent.
Note that the data
must be UTF-8 valid.
Since: 2.50
getCloseCode
websocketConnectionGetCloseCode Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m Text | Returns: the close data or |
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 #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m WebsocketConnectionType | Returns: the connection type |
Get the connection type (client/server) of the connection.
Since: 2.50
getExtensions
websocketConnectionGetExtensions Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m [WebsocketExtension] | Returns: a |
Get the extensions chosen via negotiation with the peer.
Since: 2.68
getIoStream
websocketConnectionGetIoStream Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m IOStream | Returns: the WebSocket's I/O stream. |
Get the I/O stream the WebSocket is communicating over.
Since: 2.50
getKeepaliveInterval
websocketConnectionGetKeepaliveInterval Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m Word32 | Returns: the keepalive interval. |
Gets the keepalive interval in seconds or 0 if disabled.
Since: 2.58
getMaxIncomingPayloadSize
websocketConnectionGetMaxIncomingPayloadSize Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m Word64 | Returns: the maximum payload size. |
Gets the maximum payload size allowed for incoming packets.
Since: 2.56
getOrigin
websocketConnectionGetOrigin Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m (Maybe Text) | Returns: the origin, or |
Get the origin of the WebSocket.
Since: 2.50
getProtocol
websocketConnectionGetProtocol Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m (Maybe Text) | Returns: the chosen protocol, or |
Get the protocol chosen via negotiation with the peer.
Since: 2.50
getState
websocketConnectionGetState Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m WebsocketState | Returns: the state |
Get the current state of the WebSocket.
Since: 2.50
getUri
websocketConnectionGetUri Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> 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 #
:: (HasCallStack, MonadIO m, IsIOStream a) | |
=> a |
|
-> URI |
|
-> WebsocketConnectionType |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> m WebsocketConnection | Returns: a new |
Creates a WebsocketConnection
on stream
. This should be
called after completing the handshake to begin using the WebSocket
protocol.
Since: 2.50
newWithExtensions
websocketConnectionNewWithExtensions Source #
:: (HasCallStack, MonadIO m, IsIOStream a, IsWebsocketExtension b) | |
=> a |
|
-> URI |
|
-> WebsocketConnectionType |
|
-> Maybe Text |
|
-> Maybe Text |
|
-> [b] |
|
-> m WebsocketConnection | Returns: a new |
Creates a WebsocketConnection
on stream
with the given active extensions
.
This should be called after completing the handshake to begin using the WebSocket
protocol.
Since: 2.68
sendBinary
websocketConnectionSendBinary Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> Maybe ByteString |
|
-> m () |
Send a binary message to the peer. If length
is 0, data
may be Nothing
.
The message is queued to be sent and will be sent when the main loop is run.
Since: 2.50
sendMessage
websocketConnectionSendMessage Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> WebsocketDataType |
|
-> Bytes |
|
-> m () |
Send a message of the given type
to the peer. Note that this method,
allows to send text messages containing Nothing
characters.
The message is queued to be sent and will be sent when the main loop is run.
Since: 2.68
sendText
websocketConnectionSendText Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> Text |
|
-> m () |
Send a Nothing
-terminated text (UTF-8) message to the peer. If you need
to send text messages containing Nothing
characters use
websocketConnectionSendMessage
instead.
The message is queued to be sent and will be sent when the main loop is run.
Since: 2.50
setKeepaliveInterval
websocketConnectionSetKeepaliveInterval Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> Word32 |
|
-> m () |
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.
Since: 2.58
setMaxIncomingPayloadSize
websocketConnectionSetMaxIncomingPayloadSize Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> Word64 |
|
-> m () |
Sets the maximum payload size allowed for incoming packets. It does not limit the outgoing packet size.
Since: 2.56
Properties
connectionType
The type of connection (client/server).
Since: 2.50
constructWebsocketConnectionConnectionType :: (IsWebsocketConnection o, MonadIO m) => WebsocketConnectionType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “connection-type
” property. This is rarely needed directly, but it is used by new
.
getWebsocketConnectionConnectionType :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketConnectionType Source #
Get the value of the “connection-type
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #connectionType
extensions
List of WebsocketExtension
objects that are active in the connection.
Since: 2.68
constructWebsocketConnectionExtensions :: (IsWebsocketConnection o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “extensions
” property. This is rarely needed directly, but it is used by new
.
getWebsocketConnectionExtensions :: (MonadIO m, IsWebsocketConnection o) => o -> m (Ptr ()) Source #
Get the value of the “extensions
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #extensions
ioStream
The underlying IO stream the WebSocket is communicating over.
The input and output streams must be pollable streams.
Since: 2.50
constructWebsocketConnectionIoStream :: (IsWebsocketConnection o, MonadIO m, IsIOStream a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “io-stream
” property. This is rarely needed directly, but it is used by new
.
getWebsocketConnectionIoStream :: (MonadIO m, IsWebsocketConnection o) => o -> m IOStream Source #
Get the value of the “io-stream
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #ioStream
keepaliveInterval
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.
Since: 2.58
constructWebsocketConnectionKeepaliveInterval :: (IsWebsocketConnection o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “keepalive-interval
” property. This is rarely needed directly, but it is used by new
.
getWebsocketConnectionKeepaliveInterval :: (MonadIO m, IsWebsocketConnection o) => o -> m Word32 Source #
Get the value of the “keepalive-interval
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #keepaliveInterval
setWebsocketConnectionKeepaliveInterval :: (MonadIO m, IsWebsocketConnection o) => o -> Word32 -> m () Source #
Set the value of the “keepalive-interval
” property.
When overloading is enabled, this is equivalent to
set
websocketConnection [ #keepaliveInterval:=
value ]
maxIncomingPayloadSize
The maximum payload size for incoming packets the protocol expects or 0 to not limit it.
Since: 2.56
constructWebsocketConnectionMaxIncomingPayloadSize :: (IsWebsocketConnection o, MonadIO m) => Word64 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “max-incoming-payload-size
” property. This is rarely needed directly, but it is used by new
.
getWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> m Word64 Source #
Get the value of the “max-incoming-payload-size
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #maxIncomingPayloadSize
setWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> Word64 -> m () Source #
Set the value of the “max-incoming-payload-size
” property.
When overloading is enabled, this is equivalent to
set
websocketConnection [ #maxIncomingPayloadSize:=
value ]
origin
The client's Origin.
Since: 2.50
constructWebsocketConnectionOrigin :: (IsWebsocketConnection o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “origin
” property. This is rarely needed directly, but it is used by new
.
getWebsocketConnectionOrigin :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe Text) Source #
Get the value of the “origin
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #origin
protocol
The chosen protocol, or Nothing
if a protocol was not agreed
upon.
Since: 2.50
constructWebsocketConnectionProtocol :: (IsWebsocketConnection o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “protocol
” property. This is rarely needed directly, but it is used by new
.
getWebsocketConnectionProtocol :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe Text) Source #
Get the value of the “protocol
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #protocol
state
The current state of the WebSocket.
Since: 2.50
getWebsocketConnectionState :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketState Source #
Get the value of the “state
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #state
uri
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
constructWebsocketConnectionUri :: (IsWebsocketConnection o, MonadIO m) => URI -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “uri
” property. This is rarely needed directly, but it is used by new
.
getWebsocketConnectionUri :: (MonadIO m, IsWebsocketConnection o) => o -> m URI Source #
Get the value of the “uri
” property.
When overloading is enabled, this is equivalent to
get
websocketConnection #uri
Signals
closed
type WebsocketConnectionClosedCallback = IO () Source #
Emitted when the connection has completely closed, either
due to an orderly close from the peer, one initiated via
websocketConnectionClose
or a fatal error
condition that caused a close.
This signal will be emitted once.
Since: 2.50
afterWebsocketConnectionClosed :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionClosedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the closed signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
websocketConnection #closed callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onWebsocketConnectionClosed :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionClosedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the closed signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
websocketConnection #closed callback
closing
type WebsocketConnectionClosingCallback = IO () Source #
This signal will be emitted during an orderly close.
Since: 2.50
afterWebsocketConnectionClosing :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionClosingCallback) -> m SignalHandlerId Source #
Connect a signal handler for the closing signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
websocketConnection #closing callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onWebsocketConnectionClosing :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionClosingCallback) -> m SignalHandlerId Source #
Connect a signal handler for the closing signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
websocketConnection #closing callback
error
type WebsocketConnectionErrorCallback Source #
= GError |
|
-> IO () |
Emitted when an error occurred on the WebSocket. This may be fired multiple times. Fatal errors will be followed by the WebsocketConnection::closed signal being emitted.
Since: 2.50
afterWebsocketConnectionError :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionErrorCallback) -> m SignalHandlerId Source #
Connect a signal handler for the error signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
websocketConnection #error callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onWebsocketConnectionError :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionErrorCallback) -> m SignalHandlerId Source #
Connect a signal handler for the error signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
websocketConnection #error callback
message
type WebsocketConnectionMessageCallback Source #
Emitted when we receive a message from the peer.
As a convenience, the message
data will always be
NUL-terminated, but the NUL byte will not be included in
the length count.
Since: 2.50
afterWebsocketConnectionMessage :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionMessageCallback) -> m SignalHandlerId Source #
Connect a signal handler for the message signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
websocketConnection #message callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onWebsocketConnectionMessage :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionMessageCallback) -> m SignalHandlerId Source #
Connect a signal handler for the message signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
websocketConnection #message callback
pong
type WebsocketConnectionPongCallback Source #
= Bytes |
|
-> IO () |
Emitted when we receive a Pong frame (solicited or unsolicited) from the peer.
As a convenience, the message
data will always be
NUL-terminated, but the NUL byte will not be included in
the length count.
Since: 2.60
afterWebsocketConnectionPong :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionPongCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pong signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
websocketConnection #pong callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onWebsocketConnectionPong :: (IsWebsocketConnection a, MonadIO m) => a -> ((?self :: a) => WebsocketConnectionPongCallback) -> m SignalHandlerId Source #
Connect a signal handler for the pong signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
websocketConnection #pong callback