Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
A class representing a WebSocket connection.
- newtype WebsocketConnection = WebsocketConnection (ManagedPtr WebsocketConnection)
- class GObject o => IsWebsocketConnection o
- toWebsocketConnection :: IsWebsocketConnection o => o -> IO WebsocketConnection
- noWebsocketConnection :: Maybe WebsocketConnection
- data WebsocketConnectionCloseMethodInfo
- websocketConnectionClose :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> Word16 -> Maybe Text -> m ()
- data WebsocketConnectionGetCloseCodeMethodInfo
- websocketConnectionGetCloseCode :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m Word16
- data WebsocketConnectionGetCloseDataMethodInfo
- websocketConnectionGetCloseData :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m Text
- data WebsocketConnectionGetConnectionTypeMethodInfo
- websocketConnectionGetConnectionType :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m WebsocketConnectionType
- data WebsocketConnectionGetIoStreamMethodInfo
- websocketConnectionGetIoStream :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m IOStream
- data WebsocketConnectionGetMaxIncomingPayloadSizeMethodInfo
- websocketConnectionGetMaxIncomingPayloadSize :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m Word64
- data WebsocketConnectionGetOriginMethodInfo
- websocketConnectionGetOrigin :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m (Maybe Text)
- data WebsocketConnectionGetProtocolMethodInfo
- websocketConnectionGetProtocol :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m (Maybe Text)
- data WebsocketConnectionGetStateMethodInfo
- websocketConnectionGetState :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m WebsocketState
- data WebsocketConnectionGetUriMethodInfo
- websocketConnectionGetUri :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> m URI
- websocketConnectionNew :: (HasCallStack, MonadIO m, IsIOStream a) => a -> URI -> WebsocketConnectionType -> Maybe Text -> Maybe Text -> m WebsocketConnection
- data WebsocketConnectionSendBinaryMethodInfo
- websocketConnectionSendBinary :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> ByteString -> m ()
- data WebsocketConnectionSendTextMethodInfo
- websocketConnectionSendText :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> Text -> m ()
- data WebsocketConnectionSetMaxIncomingPayloadSizeMethodInfo
- websocketConnectionSetMaxIncomingPayloadSize :: (HasCallStack, MonadIO m, IsWebsocketConnection a) => a -> Word64 -> m ()
- data WebsocketConnectionConnectionTypePropertyInfo
- constructWebsocketConnectionConnectionType :: IsWebsocketConnection o => WebsocketConnectionType -> IO (GValueConstruct o)
- getWebsocketConnectionConnectionType :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketConnectionType
- websocketConnectionConnectionType :: AttrLabelProxy "connectionType"
- data WebsocketConnectionIoStreamPropertyInfo
- constructWebsocketConnectionIoStream :: (IsWebsocketConnection o, IsIOStream a) => a -> IO (GValueConstruct o)
- getWebsocketConnectionIoStream :: (MonadIO m, IsWebsocketConnection o) => o -> m IOStream
- websocketConnectionIoStream :: AttrLabelProxy "ioStream"
- data WebsocketConnectionMaxIncomingPayloadSizePropertyInfo
- constructWebsocketConnectionMaxIncomingPayloadSize :: IsWebsocketConnection o => Word64 -> IO (GValueConstruct o)
- getWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> m Word64
- setWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> Word64 -> m ()
- websocketConnectionMaxIncomingPayloadSize :: AttrLabelProxy "maxIncomingPayloadSize"
- data WebsocketConnectionOriginPropertyInfo
- constructWebsocketConnectionOrigin :: IsWebsocketConnection o => Text -> IO (GValueConstruct o)
- getWebsocketConnectionOrigin :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe Text)
- websocketConnectionOrigin :: AttrLabelProxy "origin"
- data WebsocketConnectionProtocolPropertyInfo
- constructWebsocketConnectionProtocol :: IsWebsocketConnection o => Text -> IO (GValueConstruct o)
- getWebsocketConnectionProtocol :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe Text)
- websocketConnectionProtocol :: AttrLabelProxy "protocol"
- data WebsocketConnectionStatePropertyInfo
- getWebsocketConnectionState :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketState
- websocketConnectionState :: AttrLabelProxy "state"
- data WebsocketConnectionUriPropertyInfo
- constructWebsocketConnectionUri :: IsWebsocketConnection o => URI -> IO (GValueConstruct o)
- getWebsocketConnectionUri :: (MonadIO m, IsWebsocketConnection o) => o -> m URI
- websocketConnectionUri :: AttrLabelProxy "uri"
- type C_WebsocketConnectionClosedCallback = Ptr () -> Ptr () -> IO ()
- type WebsocketConnectionClosedCallback = IO ()
- data WebsocketConnectionClosedSignalInfo
- afterWebsocketConnectionClosed :: (GObject a, MonadIO m) => a -> WebsocketConnectionClosedCallback -> m SignalHandlerId
- genClosure_WebsocketConnectionClosed :: WebsocketConnectionClosedCallback -> IO Closure
- mk_WebsocketConnectionClosedCallback :: C_WebsocketConnectionClosedCallback -> IO (FunPtr C_WebsocketConnectionClosedCallback)
- noWebsocketConnectionClosedCallback :: Maybe WebsocketConnectionClosedCallback
- onWebsocketConnectionClosed :: (GObject a, MonadIO m) => a -> WebsocketConnectionClosedCallback -> m SignalHandlerId
- wrap_WebsocketConnectionClosedCallback :: WebsocketConnectionClosedCallback -> Ptr () -> Ptr () -> IO ()
- type C_WebsocketConnectionClosingCallback = Ptr () -> Ptr () -> IO ()
- type WebsocketConnectionClosingCallback = IO ()
- data WebsocketConnectionClosingSignalInfo
- afterWebsocketConnectionClosing :: (GObject a, MonadIO m) => a -> WebsocketConnectionClosingCallback -> m SignalHandlerId
- genClosure_WebsocketConnectionClosing :: WebsocketConnectionClosingCallback -> IO Closure
- mk_WebsocketConnectionClosingCallback :: C_WebsocketConnectionClosingCallback -> IO (FunPtr C_WebsocketConnectionClosingCallback)
- noWebsocketConnectionClosingCallback :: Maybe WebsocketConnectionClosingCallback
- onWebsocketConnectionClosing :: (GObject a, MonadIO m) => a -> WebsocketConnectionClosingCallback -> m SignalHandlerId
- wrap_WebsocketConnectionClosingCallback :: WebsocketConnectionClosingCallback -> Ptr () -> Ptr () -> IO ()
- type C_WebsocketConnectionErrorCallback = Ptr () -> Ptr GError -> Ptr () -> IO ()
- type WebsocketConnectionErrorCallback = GError -> IO ()
- data WebsocketConnectionErrorSignalInfo
- afterWebsocketConnectionError :: (GObject a, MonadIO m) => a -> WebsocketConnectionErrorCallback -> m SignalHandlerId
- genClosure_WebsocketConnectionError :: WebsocketConnectionErrorCallback -> IO Closure
- mk_WebsocketConnectionErrorCallback :: C_WebsocketConnectionErrorCallback -> IO (FunPtr C_WebsocketConnectionErrorCallback)
- noWebsocketConnectionErrorCallback :: Maybe WebsocketConnectionErrorCallback
- onWebsocketConnectionError :: (GObject a, MonadIO m) => a -> WebsocketConnectionErrorCallback -> m SignalHandlerId
- wrap_WebsocketConnectionErrorCallback :: WebsocketConnectionErrorCallback -> Ptr () -> Ptr GError -> Ptr () -> IO ()
- type C_WebsocketConnectionMessageCallback = Ptr () -> Int32 -> Ptr Bytes -> Ptr () -> IO ()
- type WebsocketConnectionMessageCallback = Int32 -> Bytes -> IO ()
- data WebsocketConnectionMessageSignalInfo
- afterWebsocketConnectionMessage :: (GObject a, MonadIO m) => a -> WebsocketConnectionMessageCallback -> m SignalHandlerId
- genClosure_WebsocketConnectionMessage :: WebsocketConnectionMessageCallback -> IO Closure
- mk_WebsocketConnectionMessageCallback :: C_WebsocketConnectionMessageCallback -> IO (FunPtr C_WebsocketConnectionMessageCallback)
- noWebsocketConnectionMessageCallback :: Maybe WebsocketConnectionMessageCallback
- onWebsocketConnectionMessage :: (GObject a, MonadIO m) => a -> WebsocketConnectionMessageCallback -> m SignalHandlerId
- wrap_WebsocketConnectionMessageCallback :: WebsocketConnectionMessageCallback -> Ptr () -> Int32 -> Ptr Bytes -> Ptr () -> IO ()
Exported types
newtype WebsocketConnection Source #
GObject WebsocketConnection Source # | |
IsObject WebsocketConnection Source # | |
IsWebsocketConnection WebsocketConnection Source # | |
((~) * info (ResolveWebsocketConnectionMethod t WebsocketConnection), MethodInfo * info WebsocketConnection p) => IsLabel t (WebsocketConnection -> p) Source # | |
((~) * info (ResolveWebsocketConnectionMethod t WebsocketConnection), MethodInfo * info WebsocketConnection p) => IsLabelProxy t (WebsocketConnection -> p) Source # | |
HasAttributeList * WebsocketConnection Source # | |
type AttributeList WebsocketConnection Source # | |
type SignalList WebsocketConnection Source # | |
class GObject o => IsWebsocketConnection o Source #
toWebsocketConnection :: IsWebsocketConnection o => o -> IO WebsocketConnection Source #
Methods
close
data WebsocketConnectionCloseMethodInfo Source #
((~) * signature (Word16 -> Maybe Text -> m ()), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionCloseMethodInfo a signature Source # | |
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.
Note that the data
must be UTF-8 valid.
Since: 2.50
getCloseCode
data WebsocketConnectionGetCloseCodeMethodInfo Source #
((~) * signature (m Word16), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetCloseCodeMethodInfo a signature Source # | |
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
data WebsocketConnectionGetCloseDataMethodInfo Source #
((~) * signature (m Text), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetCloseDataMethodInfo a signature Source # | |
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
data WebsocketConnectionGetConnectionTypeMethodInfo Source #
((~) * signature (m WebsocketConnectionType), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetConnectionTypeMethodInfo a signature Source # | |
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
getIoStream
data WebsocketConnectionGetIoStreamMethodInfo Source #
((~) * signature (m IOStream), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetIoStreamMethodInfo a signature Source # | |
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
getMaxIncomingPayloadSize
data WebsocketConnectionGetMaxIncomingPayloadSizeMethodInfo Source #
((~) * signature (m Word64), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetMaxIncomingPayloadSizeMethodInfo a signature Source # | |
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
data WebsocketConnectionGetOriginMethodInfo Source #
((~) * signature (m (Maybe Text)), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetOriginMethodInfo a signature Source # | |
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
data WebsocketConnectionGetProtocolMethodInfo Source #
((~) * signature (m (Maybe Text)), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetProtocolMethodInfo a signature Source # | |
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
data WebsocketConnectionGetStateMethodInfo Source #
((~) * signature (m WebsocketState), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetStateMethodInfo a signature Source # | |
websocketConnectionGetState Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> m WebsocketState | Returns: the state |
Get the current state of the WebSocket.
Since: 2.50
getUri
data WebsocketConnectionGetUriMethodInfo Source #
((~) * signature (m URI), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionGetUriMethodInfo a signature Source # | |
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
sendBinary
data WebsocketConnectionSendBinaryMethodInfo Source #
((~) * signature (ByteString -> m ()), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionSendBinaryMethodInfo a signature Source # | |
websocketConnectionSendBinary Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> ByteString |
|
-> 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
data WebsocketConnectionSendTextMethodInfo Source #
((~) * signature (Text -> m ()), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionSendTextMethodInfo a signature Source # | |
websocketConnectionSendText Source #
:: (HasCallStack, MonadIO m, IsWebsocketConnection a) | |
=> a |
|
-> Text |
|
-> 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
data WebsocketConnectionSetMaxIncomingPayloadSizeMethodInfo Source #
((~) * signature (Word64 -> m ()), MonadIO m, IsWebsocketConnection a) => MethodInfo * WebsocketConnectionSetMaxIncomingPayloadSizeMethodInfo a signature Source # | |
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
data WebsocketConnectionConnectionTypePropertyInfo Source #
constructWebsocketConnectionConnectionType :: IsWebsocketConnection o => WebsocketConnectionType -> IO (GValueConstruct o) Source #
getWebsocketConnectionConnectionType :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketConnectionType Source #
websocketConnectionConnectionType :: AttrLabelProxy "connectionType" Source #
ioStream
data WebsocketConnectionIoStreamPropertyInfo Source #
constructWebsocketConnectionIoStream :: (IsWebsocketConnection o, IsIOStream a) => a -> IO (GValueConstruct o) Source #
getWebsocketConnectionIoStream :: (MonadIO m, IsWebsocketConnection o) => o -> m IOStream Source #
websocketConnectionIoStream :: AttrLabelProxy "ioStream" Source #
maxIncomingPayloadSize
data WebsocketConnectionMaxIncomingPayloadSizePropertyInfo Source #
constructWebsocketConnectionMaxIncomingPayloadSize :: IsWebsocketConnection o => Word64 -> IO (GValueConstruct o) Source #
getWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> m Word64 Source #
setWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> Word64 -> m () Source #
websocketConnectionMaxIncomingPayloadSize :: AttrLabelProxy "maxIncomingPayloadSize" Source #
origin
data WebsocketConnectionOriginPropertyInfo Source #
constructWebsocketConnectionOrigin :: IsWebsocketConnection o => Text -> IO (GValueConstruct o) Source #
getWebsocketConnectionOrigin :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe Text) Source #
websocketConnectionOrigin :: AttrLabelProxy "origin" Source #
protocol
data WebsocketConnectionProtocolPropertyInfo Source #
constructWebsocketConnectionProtocol :: IsWebsocketConnection o => Text -> IO (GValueConstruct o) Source #
getWebsocketConnectionProtocol :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe Text) Source #
websocketConnectionProtocol :: AttrLabelProxy "protocol" Source #
state
data WebsocketConnectionStatePropertyInfo Source #
getWebsocketConnectionState :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketState Source #
websocketConnectionState :: AttrLabelProxy "state" Source #
uri
data WebsocketConnectionUriPropertyInfo Source #
constructWebsocketConnectionUri :: IsWebsocketConnection o => URI -> IO (GValueConstruct o) Source #
getWebsocketConnectionUri :: (MonadIO m, IsWebsocketConnection o) => o -> m URI Source #
websocketConnectionUri :: AttrLabelProxy "uri" Source #
Signals
closed
type WebsocketConnectionClosedCallback = IO () Source #
afterWebsocketConnectionClosed :: (GObject a, MonadIO m) => a -> WebsocketConnectionClosedCallback -> m SignalHandlerId Source #
mk_WebsocketConnectionClosedCallback :: C_WebsocketConnectionClosedCallback -> IO (FunPtr C_WebsocketConnectionClosedCallback) Source #
onWebsocketConnectionClosed :: (GObject a, MonadIO m) => a -> WebsocketConnectionClosedCallback -> m SignalHandlerId Source #
wrap_WebsocketConnectionClosedCallback :: WebsocketConnectionClosedCallback -> Ptr () -> Ptr () -> IO () Source #
closing
type WebsocketConnectionClosingCallback = IO () Source #
afterWebsocketConnectionClosing :: (GObject a, MonadIO m) => a -> WebsocketConnectionClosingCallback -> m SignalHandlerId Source #
mk_WebsocketConnectionClosingCallback :: C_WebsocketConnectionClosingCallback -> IO (FunPtr C_WebsocketConnectionClosingCallback) Source #
onWebsocketConnectionClosing :: (GObject a, MonadIO m) => a -> WebsocketConnectionClosingCallback -> m SignalHandlerId Source #
wrap_WebsocketConnectionClosingCallback :: WebsocketConnectionClosingCallback -> Ptr () -> Ptr () -> IO () Source #
error
type WebsocketConnectionErrorCallback = GError -> IO () Source #
afterWebsocketConnectionError :: (GObject a, MonadIO m) => a -> WebsocketConnectionErrorCallback -> m SignalHandlerId Source #
mk_WebsocketConnectionErrorCallback :: C_WebsocketConnectionErrorCallback -> IO (FunPtr C_WebsocketConnectionErrorCallback) Source #
onWebsocketConnectionError :: (GObject a, MonadIO m) => a -> WebsocketConnectionErrorCallback -> m SignalHandlerId Source #
wrap_WebsocketConnectionErrorCallback :: WebsocketConnectionErrorCallback -> Ptr () -> Ptr GError -> Ptr () -> IO () Source #
message
type C_WebsocketConnectionMessageCallback = Ptr () -> Int32 -> Ptr Bytes -> Ptr () -> IO () Source #
afterWebsocketConnectionMessage :: (GObject a, MonadIO m) => a -> WebsocketConnectionMessageCallback -> m SignalHandlerId Source #
mk_WebsocketConnectionMessageCallback :: C_WebsocketConnectionMessageCallback -> IO (FunPtr C_WebsocketConnectionMessageCallback) Source #
onWebsocketConnectionMessage :: (GObject a, MonadIO m) => a -> WebsocketConnectionMessageCallback -> m SignalHandlerId Source #
wrap_WebsocketConnectionMessageCallback :: WebsocketConnectionMessageCallback -> Ptr () -> Int32 -> Ptr Bytes -> Ptr () -> IO () Source #