gi-soup-2.4.18: GI/Soup/Objects/WebsocketConnection.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
A class representing a WebSocket connection.
/Since: 2.50/
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Soup.Objects.WebsocketConnection
(
-- * Exported types
WebsocketConnection(..) ,
IsWebsocketConnection ,
toWebsocketConnection ,
noWebsocketConnection ,
-- * Methods
-- ** close #method:close#
#if ENABLE_OVERLOADING
WebsocketConnectionCloseMethodInfo ,
#endif
websocketConnectionClose ,
-- ** getCloseCode #method:getCloseCode#
#if ENABLE_OVERLOADING
WebsocketConnectionGetCloseCodeMethodInfo,
#endif
websocketConnectionGetCloseCode ,
-- ** getCloseData #method:getCloseData#
#if ENABLE_OVERLOADING
WebsocketConnectionGetCloseDataMethodInfo,
#endif
websocketConnectionGetCloseData ,
-- ** getConnectionType #method:getConnectionType#
#if ENABLE_OVERLOADING
WebsocketConnectionGetConnectionTypeMethodInfo,
#endif
websocketConnectionGetConnectionType ,
-- ** getIoStream #method:getIoStream#
#if ENABLE_OVERLOADING
WebsocketConnectionGetIoStreamMethodInfo,
#endif
websocketConnectionGetIoStream ,
-- ** getKeepaliveInterval #method:getKeepaliveInterval#
#if ENABLE_OVERLOADING
WebsocketConnectionGetKeepaliveIntervalMethodInfo,
#endif
websocketConnectionGetKeepaliveInterval ,
-- ** getMaxIncomingPayloadSize #method:getMaxIncomingPayloadSize#
#if ENABLE_OVERLOADING
WebsocketConnectionGetMaxIncomingPayloadSizeMethodInfo,
#endif
websocketConnectionGetMaxIncomingPayloadSize,
-- ** getOrigin #method:getOrigin#
#if ENABLE_OVERLOADING
WebsocketConnectionGetOriginMethodInfo ,
#endif
websocketConnectionGetOrigin ,
-- ** getProtocol #method:getProtocol#
#if ENABLE_OVERLOADING
WebsocketConnectionGetProtocolMethodInfo,
#endif
websocketConnectionGetProtocol ,
-- ** getState #method:getState#
#if ENABLE_OVERLOADING
WebsocketConnectionGetStateMethodInfo ,
#endif
websocketConnectionGetState ,
-- ** getUri #method:getUri#
#if ENABLE_OVERLOADING
WebsocketConnectionGetUriMethodInfo ,
#endif
websocketConnectionGetUri ,
-- ** new #method:new#
websocketConnectionNew ,
-- ** sendBinary #method:sendBinary#
#if ENABLE_OVERLOADING
WebsocketConnectionSendBinaryMethodInfo ,
#endif
websocketConnectionSendBinary ,
-- ** sendText #method:sendText#
#if ENABLE_OVERLOADING
WebsocketConnectionSendTextMethodInfo ,
#endif
websocketConnectionSendText ,
-- ** setKeepaliveInterval #method:setKeepaliveInterval#
#if ENABLE_OVERLOADING
WebsocketConnectionSetKeepaliveIntervalMethodInfo,
#endif
websocketConnectionSetKeepaliveInterval ,
-- ** setMaxIncomingPayloadSize #method:setMaxIncomingPayloadSize#
#if ENABLE_OVERLOADING
WebsocketConnectionSetMaxIncomingPayloadSizeMethodInfo,
#endif
websocketConnectionSetMaxIncomingPayloadSize,
-- * Properties
-- ** connectionType #attr:connectionType#
{- | The type of connection (client\/server).
/Since: 2.50/
-}
#if ENABLE_OVERLOADING
WebsocketConnectionConnectionTypePropertyInfo,
#endif
constructWebsocketConnectionConnectionType,
getWebsocketConnectionConnectionType ,
#if ENABLE_OVERLOADING
websocketConnectionConnectionType ,
#endif
-- ** ioStream #attr:ioStream#
{- | The underlying IO stream the WebSocket is communicating
over.
The input and output streams must be pollable streams.
/Since: 2.50/
-}
#if ENABLE_OVERLOADING
WebsocketConnectionIoStreamPropertyInfo ,
#endif
constructWebsocketConnectionIoStream ,
getWebsocketConnectionIoStream ,
#if ENABLE_OVERLOADING
websocketConnectionIoStream ,
#endif
-- ** keepaliveInterval #attr: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/
-}
#if ENABLE_OVERLOADING
WebsocketConnectionKeepaliveIntervalPropertyInfo,
#endif
constructWebsocketConnectionKeepaliveInterval,
getWebsocketConnectionKeepaliveInterval ,
setWebsocketConnectionKeepaliveInterval ,
#if ENABLE_OVERLOADING
websocketConnectionKeepaliveInterval ,
#endif
-- ** maxIncomingPayloadSize #attr:maxIncomingPayloadSize#
{- | The maximum payload size for incoming packets the protocol expects
or 0 to not limit it.
/Since: 2.56/
-}
#if ENABLE_OVERLOADING
WebsocketConnectionMaxIncomingPayloadSizePropertyInfo,
#endif
constructWebsocketConnectionMaxIncomingPayloadSize,
getWebsocketConnectionMaxIncomingPayloadSize,
setWebsocketConnectionMaxIncomingPayloadSize,
#if ENABLE_OVERLOADING
websocketConnectionMaxIncomingPayloadSize,
#endif
-- ** origin #attr:origin#
{- | The client\'s Origin.
/Since: 2.50/
-}
#if ENABLE_OVERLOADING
WebsocketConnectionOriginPropertyInfo ,
#endif
constructWebsocketConnectionOrigin ,
getWebsocketConnectionOrigin ,
#if ENABLE_OVERLOADING
websocketConnectionOrigin ,
#endif
-- ** protocol #attr:protocol#
{- | The chosen protocol, or 'Nothing' if a protocol was not agreed
upon.
/Since: 2.50/
-}
#if ENABLE_OVERLOADING
WebsocketConnectionProtocolPropertyInfo ,
#endif
constructWebsocketConnectionProtocol ,
getWebsocketConnectionProtocol ,
#if ENABLE_OVERLOADING
websocketConnectionProtocol ,
#endif
-- ** state #attr:state#
{- | The current state of the WebSocket.
/Since: 2.50/
-}
#if ENABLE_OVERLOADING
WebsocketConnectionStatePropertyInfo ,
#endif
getWebsocketConnectionState ,
#if ENABLE_OVERLOADING
websocketConnectionState ,
#endif
-- ** uri #attr: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/
-}
#if ENABLE_OVERLOADING
WebsocketConnectionUriPropertyInfo ,
#endif
constructWebsocketConnectionUri ,
getWebsocketConnectionUri ,
#if ENABLE_OVERLOADING
websocketConnectionUri ,
#endif
-- * Signals
-- ** closed #signal:closed#
C_WebsocketConnectionClosedCallback ,
WebsocketConnectionClosedCallback ,
#if ENABLE_OVERLOADING
WebsocketConnectionClosedSignalInfo ,
#endif
afterWebsocketConnectionClosed ,
genClosure_WebsocketConnectionClosed ,
mk_WebsocketConnectionClosedCallback ,
noWebsocketConnectionClosedCallback ,
onWebsocketConnectionClosed ,
wrap_WebsocketConnectionClosedCallback ,
-- ** closing #signal:closing#
C_WebsocketConnectionClosingCallback ,
WebsocketConnectionClosingCallback ,
#if ENABLE_OVERLOADING
WebsocketConnectionClosingSignalInfo ,
#endif
afterWebsocketConnectionClosing ,
genClosure_WebsocketConnectionClosing ,
mk_WebsocketConnectionClosingCallback ,
noWebsocketConnectionClosingCallback ,
onWebsocketConnectionClosing ,
wrap_WebsocketConnectionClosingCallback ,
-- ** error #signal:error#
C_WebsocketConnectionErrorCallback ,
WebsocketConnectionErrorCallback ,
#if ENABLE_OVERLOADING
WebsocketConnectionErrorSignalInfo ,
#endif
afterWebsocketConnectionError ,
genClosure_WebsocketConnectionError ,
mk_WebsocketConnectionErrorCallback ,
noWebsocketConnectionErrorCallback ,
onWebsocketConnectionError ,
wrap_WebsocketConnectionErrorCallback ,
-- ** message #signal:message#
C_WebsocketConnectionMessageCallback ,
WebsocketConnectionMessageCallback ,
#if ENABLE_OVERLOADING
WebsocketConnectionMessageSignalInfo ,
#endif
afterWebsocketConnectionMessage ,
genClosure_WebsocketConnectionMessage ,
mk_WebsocketConnectionMessageCallback ,
noWebsocketConnectionMessageCallback ,
onWebsocketConnectionMessage ,
wrap_WebsocketConnectionMessageCallback ,
-- ** pong #signal:pong#
C_WebsocketConnectionPongCallback ,
WebsocketConnectionPongCallback ,
#if ENABLE_OVERLOADING
WebsocketConnectionPongSignalInfo ,
#endif
afterWebsocketConnectionPong ,
genClosure_WebsocketConnectionPong ,
mk_WebsocketConnectionPongCallback ,
noWebsocketConnectionPongCallback ,
onWebsocketConnectionPong ,
wrap_WebsocketConnectionPongCallback ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.Gio.Objects.IOStream as Gio.IOStream
import {-# SOURCE #-} qualified GI.Soup.Enums as Soup.Enums
import {-# SOURCE #-} qualified GI.Soup.Structs.URI as Soup.URI
-- | Memory-managed wrapper type.
newtype WebsocketConnection = WebsocketConnection (ManagedPtr WebsocketConnection)
foreign import ccall "soup_websocket_connection_get_type"
c_soup_websocket_connection_get_type :: IO GType
instance GObject WebsocketConnection where
gobjectType = c_soup_websocket_connection_get_type
-- | Type class for types which can be safely cast to `WebsocketConnection`, for instance with `toWebsocketConnection`.
class (GObject o, O.IsDescendantOf WebsocketConnection o) => IsWebsocketConnection o
instance (GObject o, O.IsDescendantOf WebsocketConnection o) => IsWebsocketConnection o
instance O.HasParentTypes WebsocketConnection
type instance O.ParentTypes WebsocketConnection = '[GObject.Object.Object]
-- | Cast to `WebsocketConnection`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toWebsocketConnection :: (MonadIO m, IsWebsocketConnection o) => o -> m WebsocketConnection
toWebsocketConnection = liftIO . unsafeCastTo WebsocketConnection
-- | A convenience alias for `Nothing` :: `Maybe` `WebsocketConnection`.
noWebsocketConnection :: Maybe WebsocketConnection
noWebsocketConnection = Nothing
#if ENABLE_OVERLOADING
type family ResolveWebsocketConnectionMethod (t :: Symbol) (o :: *) :: * where
ResolveWebsocketConnectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveWebsocketConnectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveWebsocketConnectionMethod "close" o = WebsocketConnectionCloseMethodInfo
ResolveWebsocketConnectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveWebsocketConnectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveWebsocketConnectionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveWebsocketConnectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveWebsocketConnectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveWebsocketConnectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveWebsocketConnectionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveWebsocketConnectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveWebsocketConnectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveWebsocketConnectionMethod "sendBinary" o = WebsocketConnectionSendBinaryMethodInfo
ResolveWebsocketConnectionMethod "sendText" o = WebsocketConnectionSendTextMethodInfo
ResolveWebsocketConnectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveWebsocketConnectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveWebsocketConnectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveWebsocketConnectionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveWebsocketConnectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveWebsocketConnectionMethod "getCloseCode" o = WebsocketConnectionGetCloseCodeMethodInfo
ResolveWebsocketConnectionMethod "getCloseData" o = WebsocketConnectionGetCloseDataMethodInfo
ResolveWebsocketConnectionMethod "getConnectionType" o = WebsocketConnectionGetConnectionTypeMethodInfo
ResolveWebsocketConnectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveWebsocketConnectionMethod "getIoStream" o = WebsocketConnectionGetIoStreamMethodInfo
ResolveWebsocketConnectionMethod "getKeepaliveInterval" o = WebsocketConnectionGetKeepaliveIntervalMethodInfo
ResolveWebsocketConnectionMethod "getMaxIncomingPayloadSize" o = WebsocketConnectionGetMaxIncomingPayloadSizeMethodInfo
ResolveWebsocketConnectionMethod "getOrigin" o = WebsocketConnectionGetOriginMethodInfo
ResolveWebsocketConnectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveWebsocketConnectionMethod "getProtocol" o = WebsocketConnectionGetProtocolMethodInfo
ResolveWebsocketConnectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveWebsocketConnectionMethod "getState" o = WebsocketConnectionGetStateMethodInfo
ResolveWebsocketConnectionMethod "getUri" o = WebsocketConnectionGetUriMethodInfo
ResolveWebsocketConnectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveWebsocketConnectionMethod "setKeepaliveInterval" o = WebsocketConnectionSetKeepaliveIntervalMethodInfo
ResolveWebsocketConnectionMethod "setMaxIncomingPayloadSize" o = WebsocketConnectionSetMaxIncomingPayloadSizeMethodInfo
ResolveWebsocketConnectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveWebsocketConnectionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveWebsocketConnectionMethod t WebsocketConnection, O.MethodInfo info WebsocketConnection p) => OL.IsLabel t (WebsocketConnection -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
-- signal WebsocketConnection::closed
{- |
Emitted when the connection has completely closed, either
due to an orderly close from the peer, one initiated via
'GI.Soup.Objects.WebsocketConnection.websocketConnectionClose' or a fatal error
condition that caused a close.
This signal will be emitted once.
/Since: 2.50/
-}
type WebsocketConnectionClosedCallback =
IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `WebsocketConnectionClosedCallback`@.
noWebsocketConnectionClosedCallback :: Maybe WebsocketConnectionClosedCallback
noWebsocketConnectionClosedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_WebsocketConnectionClosedCallback =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_WebsocketConnectionClosedCallback`.
foreign import ccall "wrapper"
mk_WebsocketConnectionClosedCallback :: C_WebsocketConnectionClosedCallback -> IO (FunPtr C_WebsocketConnectionClosedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_WebsocketConnectionClosed :: MonadIO m => WebsocketConnectionClosedCallback -> m (GClosure C_WebsocketConnectionClosedCallback)
genClosure_WebsocketConnectionClosed cb = liftIO $ do
let cb' = wrap_WebsocketConnectionClosedCallback cb
mk_WebsocketConnectionClosedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `WebsocketConnectionClosedCallback` into a `C_WebsocketConnectionClosedCallback`.
wrap_WebsocketConnectionClosedCallback ::
WebsocketConnectionClosedCallback ->
C_WebsocketConnectionClosedCallback
wrap_WebsocketConnectionClosedCallback _cb _ _ = do
_cb
{- |
Connect a signal handler for the “@closed@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' websocketConnection #closed callback
@
-}
onWebsocketConnectionClosed :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionClosedCallback -> m SignalHandlerId
onWebsocketConnectionClosed obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionClosedCallback cb
cb'' <- mk_WebsocketConnectionClosedCallback cb'
connectSignalFunPtr obj "closed" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@closed@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' websocketConnection #closed callback
@
-}
afterWebsocketConnectionClosed :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionClosedCallback -> m SignalHandlerId
afterWebsocketConnectionClosed obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionClosedCallback cb
cb'' <- mk_WebsocketConnectionClosedCallback cb'
connectSignalFunPtr obj "closed" cb'' SignalConnectAfter
-- signal WebsocketConnection::closing
{- |
This signal will be emitted during an orderly close.
/Since: 2.50/
-}
type WebsocketConnectionClosingCallback =
IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `WebsocketConnectionClosingCallback`@.
noWebsocketConnectionClosingCallback :: Maybe WebsocketConnectionClosingCallback
noWebsocketConnectionClosingCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_WebsocketConnectionClosingCallback =
Ptr () -> -- object
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_WebsocketConnectionClosingCallback`.
foreign import ccall "wrapper"
mk_WebsocketConnectionClosingCallback :: C_WebsocketConnectionClosingCallback -> IO (FunPtr C_WebsocketConnectionClosingCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_WebsocketConnectionClosing :: MonadIO m => WebsocketConnectionClosingCallback -> m (GClosure C_WebsocketConnectionClosingCallback)
genClosure_WebsocketConnectionClosing cb = liftIO $ do
let cb' = wrap_WebsocketConnectionClosingCallback cb
mk_WebsocketConnectionClosingCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `WebsocketConnectionClosingCallback` into a `C_WebsocketConnectionClosingCallback`.
wrap_WebsocketConnectionClosingCallback ::
WebsocketConnectionClosingCallback ->
C_WebsocketConnectionClosingCallback
wrap_WebsocketConnectionClosingCallback _cb _ _ = do
_cb
{- |
Connect a signal handler for the “@closing@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' websocketConnection #closing callback
@
-}
onWebsocketConnectionClosing :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionClosingCallback -> m SignalHandlerId
onWebsocketConnectionClosing obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionClosingCallback cb
cb'' <- mk_WebsocketConnectionClosingCallback cb'
connectSignalFunPtr obj "closing" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@closing@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' websocketConnection #closing callback
@
-}
afterWebsocketConnectionClosing :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionClosingCallback -> m SignalHandlerId
afterWebsocketConnectionClosing obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionClosingCallback cb
cb'' <- mk_WebsocketConnectionClosingCallback cb'
connectSignalFunPtr obj "closing" cb'' SignalConnectAfter
-- signal WebsocketConnection::error
{- |
Emitted when an error occurred on the WebSocket. This may
be fired multiple times. Fatal errors will be followed by
the 'GI.Soup.Objects.WebsocketConnection.WebsocketConnection'::@/closed/@ signal being emitted.
/Since: 2.50/
-}
type WebsocketConnectionErrorCallback =
GError
{- ^ /@error@/: the error that occured -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `WebsocketConnectionErrorCallback`@.
noWebsocketConnectionErrorCallback :: Maybe WebsocketConnectionErrorCallback
noWebsocketConnectionErrorCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_WebsocketConnectionErrorCallback =
Ptr () -> -- object
Ptr GError ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_WebsocketConnectionErrorCallback`.
foreign import ccall "wrapper"
mk_WebsocketConnectionErrorCallback :: C_WebsocketConnectionErrorCallback -> IO (FunPtr C_WebsocketConnectionErrorCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_WebsocketConnectionError :: MonadIO m => WebsocketConnectionErrorCallback -> m (GClosure C_WebsocketConnectionErrorCallback)
genClosure_WebsocketConnectionError cb = liftIO $ do
let cb' = wrap_WebsocketConnectionErrorCallback cb
mk_WebsocketConnectionErrorCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `WebsocketConnectionErrorCallback` into a `C_WebsocketConnectionErrorCallback`.
wrap_WebsocketConnectionErrorCallback ::
WebsocketConnectionErrorCallback ->
C_WebsocketConnectionErrorCallback
wrap_WebsocketConnectionErrorCallback _cb _ error_ _ = do
error_' <- (newBoxed GError) error_
_cb error_'
{- |
Connect a signal handler for the “@error@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' websocketConnection #error callback
@
-}
onWebsocketConnectionError :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionErrorCallback -> m SignalHandlerId
onWebsocketConnectionError obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionErrorCallback cb
cb'' <- mk_WebsocketConnectionErrorCallback cb'
connectSignalFunPtr obj "error" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@error@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' websocketConnection #error callback
@
-}
afterWebsocketConnectionError :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionErrorCallback -> m SignalHandlerId
afterWebsocketConnectionError obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionErrorCallback cb
cb'' <- mk_WebsocketConnectionErrorCallback cb'
connectSignalFunPtr obj "error" cb'' SignalConnectAfter
-- signal WebsocketConnection::message
{- |
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/
-}
type WebsocketConnectionMessageCallback =
Int32
{- ^ /@type@/: the type of message contents -}
-> GLib.Bytes.Bytes
{- ^ /@message@/: the message data -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `WebsocketConnectionMessageCallback`@.
noWebsocketConnectionMessageCallback :: Maybe WebsocketConnectionMessageCallback
noWebsocketConnectionMessageCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_WebsocketConnectionMessageCallback =
Ptr () -> -- object
Int32 ->
Ptr GLib.Bytes.Bytes ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_WebsocketConnectionMessageCallback`.
foreign import ccall "wrapper"
mk_WebsocketConnectionMessageCallback :: C_WebsocketConnectionMessageCallback -> IO (FunPtr C_WebsocketConnectionMessageCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_WebsocketConnectionMessage :: MonadIO m => WebsocketConnectionMessageCallback -> m (GClosure C_WebsocketConnectionMessageCallback)
genClosure_WebsocketConnectionMessage cb = liftIO $ do
let cb' = wrap_WebsocketConnectionMessageCallback cb
mk_WebsocketConnectionMessageCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `WebsocketConnectionMessageCallback` into a `C_WebsocketConnectionMessageCallback`.
wrap_WebsocketConnectionMessageCallback ::
WebsocketConnectionMessageCallback ->
C_WebsocketConnectionMessageCallback
wrap_WebsocketConnectionMessageCallback _cb _ type_ message _ = do
B.ManagedPtr.withTransient GLib.Bytes.Bytes message $ \message' -> do
_cb type_ message'
{- |
Connect a signal handler for the “@message@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' websocketConnection #message callback
@
-}
onWebsocketConnectionMessage :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionMessageCallback -> m SignalHandlerId
onWebsocketConnectionMessage obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionMessageCallback cb
cb'' <- mk_WebsocketConnectionMessageCallback cb'
connectSignalFunPtr obj "message" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@message@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' websocketConnection #message callback
@
-}
afterWebsocketConnectionMessage :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionMessageCallback -> m SignalHandlerId
afterWebsocketConnectionMessage obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionMessageCallback cb
cb'' <- mk_WebsocketConnectionMessageCallback cb'
connectSignalFunPtr obj "message" cb'' SignalConnectAfter
-- signal WebsocketConnection::pong
{- |
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/
-}
type WebsocketConnectionPongCallback =
GLib.Bytes.Bytes
{- ^ /@message@/: the application data (if any) -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `WebsocketConnectionPongCallback`@.
noWebsocketConnectionPongCallback :: Maybe WebsocketConnectionPongCallback
noWebsocketConnectionPongCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_WebsocketConnectionPongCallback =
Ptr () -> -- object
Ptr GLib.Bytes.Bytes ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_WebsocketConnectionPongCallback`.
foreign import ccall "wrapper"
mk_WebsocketConnectionPongCallback :: C_WebsocketConnectionPongCallback -> IO (FunPtr C_WebsocketConnectionPongCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_WebsocketConnectionPong :: MonadIO m => WebsocketConnectionPongCallback -> m (GClosure C_WebsocketConnectionPongCallback)
genClosure_WebsocketConnectionPong cb = liftIO $ do
let cb' = wrap_WebsocketConnectionPongCallback cb
mk_WebsocketConnectionPongCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `WebsocketConnectionPongCallback` into a `C_WebsocketConnectionPongCallback`.
wrap_WebsocketConnectionPongCallback ::
WebsocketConnectionPongCallback ->
C_WebsocketConnectionPongCallback
wrap_WebsocketConnectionPongCallback _cb _ message _ = do
B.ManagedPtr.withTransient GLib.Bytes.Bytes message $ \message' -> do
_cb message'
{- |
Connect a signal handler for the “@pong@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' websocketConnection #pong callback
@
-}
onWebsocketConnectionPong :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionPongCallback -> m SignalHandlerId
onWebsocketConnectionPong obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionPongCallback cb
cb'' <- mk_WebsocketConnectionPongCallback cb'
connectSignalFunPtr obj "pong" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@pong@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' websocketConnection #pong callback
@
-}
afterWebsocketConnectionPong :: (IsWebsocketConnection a, MonadIO m) => a -> WebsocketConnectionPongCallback -> m SignalHandlerId
afterWebsocketConnectionPong obj cb = liftIO $ do
let cb' = wrap_WebsocketConnectionPongCallback cb
cb'' <- mk_WebsocketConnectionPongCallback cb'
connectSignalFunPtr obj "pong" cb'' SignalConnectAfter
-- VVV Prop "connection-type"
-- Type: TInterface (Name {namespace = "Soup", name = "WebsocketConnectionType"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Just False,Nothing)
{- |
Get the value of the “@connection-type@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' websocketConnection #connectionType
@
-}
getWebsocketConnectionConnectionType :: (MonadIO m, IsWebsocketConnection o) => o -> m Soup.Enums.WebsocketConnectionType
getWebsocketConnectionConnectionType obj = liftIO $ B.Properties.getObjectPropertyEnum obj "connection-type"
{- |
Construct a `GValueConstruct` with valid value for the “@connection-type@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructWebsocketConnectionConnectionType :: (IsWebsocketConnection o) => Soup.Enums.WebsocketConnectionType -> IO (GValueConstruct o)
constructWebsocketConnectionConnectionType val = B.Properties.constructObjectPropertyEnum "connection-type" val
#if ENABLE_OVERLOADING
data WebsocketConnectionConnectionTypePropertyInfo
instance AttrInfo WebsocketConnectionConnectionTypePropertyInfo where
type AttrAllowedOps WebsocketConnectionConnectionTypePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint WebsocketConnectionConnectionTypePropertyInfo = (~) Soup.Enums.WebsocketConnectionType
type AttrBaseTypeConstraint WebsocketConnectionConnectionTypePropertyInfo = IsWebsocketConnection
type AttrGetType WebsocketConnectionConnectionTypePropertyInfo = Soup.Enums.WebsocketConnectionType
type AttrLabel WebsocketConnectionConnectionTypePropertyInfo = "connection-type"
type AttrOrigin WebsocketConnectionConnectionTypePropertyInfo = WebsocketConnection
attrGet _ = getWebsocketConnectionConnectionType
attrSet _ = undefined
attrConstruct _ = constructWebsocketConnectionConnectionType
attrClear _ = undefined
#endif
-- VVV Prop "io-stream"
-- Type: TInterface (Name {namespace = "Gio", name = "IOStream"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Just False,Nothing)
{- |
Get the value of the “@io-stream@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' websocketConnection #ioStream
@
-}
getWebsocketConnectionIoStream :: (MonadIO m, IsWebsocketConnection o) => o -> m Gio.IOStream.IOStream
getWebsocketConnectionIoStream obj = liftIO $ checkUnexpectedNothing "getWebsocketConnectionIoStream" $ B.Properties.getObjectPropertyObject obj "io-stream" Gio.IOStream.IOStream
{- |
Construct a `GValueConstruct` with valid value for the “@io-stream@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructWebsocketConnectionIoStream :: (IsWebsocketConnection o, Gio.IOStream.IsIOStream a) => a -> IO (GValueConstruct o)
constructWebsocketConnectionIoStream val = B.Properties.constructObjectPropertyObject "io-stream" (Just val)
#if ENABLE_OVERLOADING
data WebsocketConnectionIoStreamPropertyInfo
instance AttrInfo WebsocketConnectionIoStreamPropertyInfo where
type AttrAllowedOps WebsocketConnectionIoStreamPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint WebsocketConnectionIoStreamPropertyInfo = Gio.IOStream.IsIOStream
type AttrBaseTypeConstraint WebsocketConnectionIoStreamPropertyInfo = IsWebsocketConnection
type AttrGetType WebsocketConnectionIoStreamPropertyInfo = Gio.IOStream.IOStream
type AttrLabel WebsocketConnectionIoStreamPropertyInfo = "io-stream"
type AttrOrigin WebsocketConnectionIoStreamPropertyInfo = WebsocketConnection
attrGet _ = getWebsocketConnectionIoStream
attrSet _ = undefined
attrConstruct _ = constructWebsocketConnectionIoStream
attrClear _ = undefined
#endif
-- VVV Prop "keepalive-interval"
-- Type: TBasicType TUInt
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
-- Nullable: (Just False,Just False)
{- |
Get the value of the “@keepalive-interval@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' websocketConnection #keepaliveInterval
@
-}
getWebsocketConnectionKeepaliveInterval :: (MonadIO m, IsWebsocketConnection o) => o -> m Word32
getWebsocketConnectionKeepaliveInterval obj = liftIO $ B.Properties.getObjectPropertyUInt32 obj "keepalive-interval"
{- |
Set the value of the “@keepalive-interval@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' websocketConnection [ #keepaliveInterval 'Data.GI.Base.Attributes.:=' value ]
@
-}
setWebsocketConnectionKeepaliveInterval :: (MonadIO m, IsWebsocketConnection o) => o -> Word32 -> m ()
setWebsocketConnectionKeepaliveInterval obj val = liftIO $ B.Properties.setObjectPropertyUInt32 obj "keepalive-interval" val
{- |
Construct a `GValueConstruct` with valid value for the “@keepalive-interval@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructWebsocketConnectionKeepaliveInterval :: (IsWebsocketConnection o) => Word32 -> IO (GValueConstruct o)
constructWebsocketConnectionKeepaliveInterval val = B.Properties.constructObjectPropertyUInt32 "keepalive-interval" val
#if ENABLE_OVERLOADING
data WebsocketConnectionKeepaliveIntervalPropertyInfo
instance AttrInfo WebsocketConnectionKeepaliveIntervalPropertyInfo where
type AttrAllowedOps WebsocketConnectionKeepaliveIntervalPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint WebsocketConnectionKeepaliveIntervalPropertyInfo = (~) Word32
type AttrBaseTypeConstraint WebsocketConnectionKeepaliveIntervalPropertyInfo = IsWebsocketConnection
type AttrGetType WebsocketConnectionKeepaliveIntervalPropertyInfo = Word32
type AttrLabel WebsocketConnectionKeepaliveIntervalPropertyInfo = "keepalive-interval"
type AttrOrigin WebsocketConnectionKeepaliveIntervalPropertyInfo = WebsocketConnection
attrGet _ = getWebsocketConnectionKeepaliveInterval
attrSet _ = setWebsocketConnectionKeepaliveInterval
attrConstruct _ = constructWebsocketConnectionKeepaliveInterval
attrClear _ = undefined
#endif
-- VVV Prop "max-incoming-payload-size"
-- Type: TBasicType TUInt64
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstruct]
-- Nullable: (Just False,Just False)
{- |
Get the value of the “@max-incoming-payload-size@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' websocketConnection #maxIncomingPayloadSize
@
-}
getWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> m Word64
getWebsocketConnectionMaxIncomingPayloadSize obj = liftIO $ B.Properties.getObjectPropertyUInt64 obj "max-incoming-payload-size"
{- |
Set the value of the “@max-incoming-payload-size@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' websocketConnection [ #maxIncomingPayloadSize 'Data.GI.Base.Attributes.:=' value ]
@
-}
setWebsocketConnectionMaxIncomingPayloadSize :: (MonadIO m, IsWebsocketConnection o) => o -> Word64 -> m ()
setWebsocketConnectionMaxIncomingPayloadSize obj val = liftIO $ B.Properties.setObjectPropertyUInt64 obj "max-incoming-payload-size" val
{- |
Construct a `GValueConstruct` with valid value for the “@max-incoming-payload-size@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructWebsocketConnectionMaxIncomingPayloadSize :: (IsWebsocketConnection o) => Word64 -> IO (GValueConstruct o)
constructWebsocketConnectionMaxIncomingPayloadSize val = B.Properties.constructObjectPropertyUInt64 "max-incoming-payload-size" val
#if ENABLE_OVERLOADING
data WebsocketConnectionMaxIncomingPayloadSizePropertyInfo
instance AttrInfo WebsocketConnectionMaxIncomingPayloadSizePropertyInfo where
type AttrAllowedOps WebsocketConnectionMaxIncomingPayloadSizePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint WebsocketConnectionMaxIncomingPayloadSizePropertyInfo = (~) Word64
type AttrBaseTypeConstraint WebsocketConnectionMaxIncomingPayloadSizePropertyInfo = IsWebsocketConnection
type AttrGetType WebsocketConnectionMaxIncomingPayloadSizePropertyInfo = Word64
type AttrLabel WebsocketConnectionMaxIncomingPayloadSizePropertyInfo = "max-incoming-payload-size"
type AttrOrigin WebsocketConnectionMaxIncomingPayloadSizePropertyInfo = WebsocketConnection
attrGet _ = getWebsocketConnectionMaxIncomingPayloadSize
attrSet _ = setWebsocketConnectionMaxIncomingPayloadSize
attrConstruct _ = constructWebsocketConnectionMaxIncomingPayloadSize
attrClear _ = undefined
#endif
-- VVV Prop "origin"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Just True,Nothing)
{- |
Get the value of the “@origin@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' websocketConnection #origin
@
-}
getWebsocketConnectionOrigin :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe T.Text)
getWebsocketConnectionOrigin obj = liftIO $ B.Properties.getObjectPropertyString obj "origin"
{- |
Construct a `GValueConstruct` with valid value for the “@origin@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructWebsocketConnectionOrigin :: (IsWebsocketConnection o) => T.Text -> IO (GValueConstruct o)
constructWebsocketConnectionOrigin val = B.Properties.constructObjectPropertyString "origin" (Just val)
#if ENABLE_OVERLOADING
data WebsocketConnectionOriginPropertyInfo
instance AttrInfo WebsocketConnectionOriginPropertyInfo where
type AttrAllowedOps WebsocketConnectionOriginPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint WebsocketConnectionOriginPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint WebsocketConnectionOriginPropertyInfo = IsWebsocketConnection
type AttrGetType WebsocketConnectionOriginPropertyInfo = (Maybe T.Text)
type AttrLabel WebsocketConnectionOriginPropertyInfo = "origin"
type AttrOrigin WebsocketConnectionOriginPropertyInfo = WebsocketConnection
attrGet _ = getWebsocketConnectionOrigin
attrSet _ = undefined
attrConstruct _ = constructWebsocketConnectionOrigin
attrClear _ = undefined
#endif
-- VVV Prop "protocol"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Just True,Nothing)
{- |
Get the value of the “@protocol@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' websocketConnection #protocol
@
-}
getWebsocketConnectionProtocol :: (MonadIO m, IsWebsocketConnection o) => o -> m (Maybe T.Text)
getWebsocketConnectionProtocol obj = liftIO $ B.Properties.getObjectPropertyString obj "protocol"
{- |
Construct a `GValueConstruct` with valid value for the “@protocol@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructWebsocketConnectionProtocol :: (IsWebsocketConnection o) => T.Text -> IO (GValueConstruct o)
constructWebsocketConnectionProtocol val = B.Properties.constructObjectPropertyString "protocol" (Just val)
#if ENABLE_OVERLOADING
data WebsocketConnectionProtocolPropertyInfo
instance AttrInfo WebsocketConnectionProtocolPropertyInfo where
type AttrAllowedOps WebsocketConnectionProtocolPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint WebsocketConnectionProtocolPropertyInfo = (~) T.Text
type AttrBaseTypeConstraint WebsocketConnectionProtocolPropertyInfo = IsWebsocketConnection
type AttrGetType WebsocketConnectionProtocolPropertyInfo = (Maybe T.Text)
type AttrLabel WebsocketConnectionProtocolPropertyInfo = "protocol"
type AttrOrigin WebsocketConnectionProtocolPropertyInfo = WebsocketConnection
attrGet _ = getWebsocketConnectionProtocol
attrSet _ = undefined
attrConstruct _ = constructWebsocketConnectionProtocol
attrClear _ = undefined
#endif
-- VVV Prop "state"
-- Type: TInterface (Name {namespace = "Soup", name = "WebsocketState"})
-- Flags: [PropertyReadable]
-- Nullable: (Just False,Nothing)
{- |
Get the value of the “@state@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' websocketConnection #state
@
-}
getWebsocketConnectionState :: (MonadIO m, IsWebsocketConnection o) => o -> m Soup.Enums.WebsocketState
getWebsocketConnectionState obj = liftIO $ B.Properties.getObjectPropertyEnum obj "state"
#if ENABLE_OVERLOADING
data WebsocketConnectionStatePropertyInfo
instance AttrInfo WebsocketConnectionStatePropertyInfo where
type AttrAllowedOps WebsocketConnectionStatePropertyInfo = '[ 'AttrGet]
type AttrSetTypeConstraint WebsocketConnectionStatePropertyInfo = (~) ()
type AttrBaseTypeConstraint WebsocketConnectionStatePropertyInfo = IsWebsocketConnection
type AttrGetType WebsocketConnectionStatePropertyInfo = Soup.Enums.WebsocketState
type AttrLabel WebsocketConnectionStatePropertyInfo = "state"
type AttrOrigin WebsocketConnectionStatePropertyInfo = WebsocketConnection
attrGet _ = getWebsocketConnectionState
attrSet _ = undefined
attrConstruct _ = undefined
attrClear _ = undefined
#endif
-- VVV Prop "uri"
-- Type: TInterface (Name {namespace = "Soup", name = "URI"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Just False,Nothing)
{- |
Get the value of the “@uri@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' websocketConnection #uri
@
-}
getWebsocketConnectionUri :: (MonadIO m, IsWebsocketConnection o) => o -> m Soup.URI.URI
getWebsocketConnectionUri obj = liftIO $ checkUnexpectedNothing "getWebsocketConnectionUri" $ B.Properties.getObjectPropertyBoxed obj "uri" Soup.URI.URI
{- |
Construct a `GValueConstruct` with valid value for the “@uri@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructWebsocketConnectionUri :: (IsWebsocketConnection o) => Soup.URI.URI -> IO (GValueConstruct o)
constructWebsocketConnectionUri val = B.Properties.constructObjectPropertyBoxed "uri" (Just val)
#if ENABLE_OVERLOADING
data WebsocketConnectionUriPropertyInfo
instance AttrInfo WebsocketConnectionUriPropertyInfo where
type AttrAllowedOps WebsocketConnectionUriPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint WebsocketConnectionUriPropertyInfo = (~) Soup.URI.URI
type AttrBaseTypeConstraint WebsocketConnectionUriPropertyInfo = IsWebsocketConnection
type AttrGetType WebsocketConnectionUriPropertyInfo = Soup.URI.URI
type AttrLabel WebsocketConnectionUriPropertyInfo = "uri"
type AttrOrigin WebsocketConnectionUriPropertyInfo = WebsocketConnection
attrGet _ = getWebsocketConnectionUri
attrSet _ = undefined
attrConstruct _ = constructWebsocketConnectionUri
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList WebsocketConnection
type instance O.AttributeList WebsocketConnection = WebsocketConnectionAttributeList
type WebsocketConnectionAttributeList = ('[ '("connectionType", WebsocketConnectionConnectionTypePropertyInfo), '("ioStream", WebsocketConnectionIoStreamPropertyInfo), '("keepaliveInterval", WebsocketConnectionKeepaliveIntervalPropertyInfo), '("maxIncomingPayloadSize", WebsocketConnectionMaxIncomingPayloadSizePropertyInfo), '("origin", WebsocketConnectionOriginPropertyInfo), '("protocol", WebsocketConnectionProtocolPropertyInfo), '("state", WebsocketConnectionStatePropertyInfo), '("uri", WebsocketConnectionUriPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
websocketConnectionConnectionType :: AttrLabelProxy "connectionType"
websocketConnectionConnectionType = AttrLabelProxy
websocketConnectionIoStream :: AttrLabelProxy "ioStream"
websocketConnectionIoStream = AttrLabelProxy
websocketConnectionKeepaliveInterval :: AttrLabelProxy "keepaliveInterval"
websocketConnectionKeepaliveInterval = AttrLabelProxy
websocketConnectionMaxIncomingPayloadSize :: AttrLabelProxy "maxIncomingPayloadSize"
websocketConnectionMaxIncomingPayloadSize = AttrLabelProxy
websocketConnectionOrigin :: AttrLabelProxy "origin"
websocketConnectionOrigin = AttrLabelProxy
websocketConnectionProtocol :: AttrLabelProxy "protocol"
websocketConnectionProtocol = AttrLabelProxy
websocketConnectionState :: AttrLabelProxy "state"
websocketConnectionState = AttrLabelProxy
websocketConnectionUri :: AttrLabelProxy "uri"
websocketConnectionUri = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
data WebsocketConnectionClosedSignalInfo
instance SignalInfo WebsocketConnectionClosedSignalInfo where
type HaskellCallbackType WebsocketConnectionClosedSignalInfo = WebsocketConnectionClosedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebsocketConnectionClosedCallback cb
cb'' <- mk_WebsocketConnectionClosedCallback cb'
connectSignalFunPtr obj "closed" cb'' connectMode
data WebsocketConnectionClosingSignalInfo
instance SignalInfo WebsocketConnectionClosingSignalInfo where
type HaskellCallbackType WebsocketConnectionClosingSignalInfo = WebsocketConnectionClosingCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebsocketConnectionClosingCallback cb
cb'' <- mk_WebsocketConnectionClosingCallback cb'
connectSignalFunPtr obj "closing" cb'' connectMode
data WebsocketConnectionErrorSignalInfo
instance SignalInfo WebsocketConnectionErrorSignalInfo where
type HaskellCallbackType WebsocketConnectionErrorSignalInfo = WebsocketConnectionErrorCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebsocketConnectionErrorCallback cb
cb'' <- mk_WebsocketConnectionErrorCallback cb'
connectSignalFunPtr obj "error" cb'' connectMode
data WebsocketConnectionMessageSignalInfo
instance SignalInfo WebsocketConnectionMessageSignalInfo where
type HaskellCallbackType WebsocketConnectionMessageSignalInfo = WebsocketConnectionMessageCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebsocketConnectionMessageCallback cb
cb'' <- mk_WebsocketConnectionMessageCallback cb'
connectSignalFunPtr obj "message" cb'' connectMode
data WebsocketConnectionPongSignalInfo
instance SignalInfo WebsocketConnectionPongSignalInfo where
type HaskellCallbackType WebsocketConnectionPongSignalInfo = WebsocketConnectionPongCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebsocketConnectionPongCallback cb
cb'' <- mk_WebsocketConnectionPongCallback cb'
connectSignalFunPtr obj "pong" cb'' connectMode
type instance O.SignalList WebsocketConnection = WebsocketConnectionSignalList
type WebsocketConnectionSignalList = ('[ '("closed", WebsocketConnectionClosedSignalInfo), '("closing", WebsocketConnectionClosingSignalInfo), '("error", WebsocketConnectionErrorSignalInfo), '("message", WebsocketConnectionMessageSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("pong", WebsocketConnectionPongSignalInfo)] :: [(Symbol, *)])
#endif
-- method WebsocketConnection::new
-- method type : Constructor
-- Args : [Arg {argCName = "stream", argType = TInterface (Name {namespace = "Gio", name = "IOStream"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GIOStream connected to the WebSocket server", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "uri", argType = TInterface (Name {namespace = "Soup", name = "URI"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the URI of the connection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "type", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnectionType"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the type of connection (client/side)", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "origin", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the Origin of the client", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "protocol", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "the subprotocol in use", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}))
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_new" soup_websocket_connection_new ::
Ptr Gio.IOStream.IOStream -> -- stream : TInterface (Name {namespace = "Gio", name = "IOStream"})
Ptr Soup.URI.URI -> -- uri : TInterface (Name {namespace = "Soup", name = "URI"})
CUInt -> -- type : TInterface (Name {namespace = "Soup", name = "WebsocketConnectionType"})
CString -> -- origin : TBasicType TUTF8
CString -> -- protocol : TBasicType TUTF8
IO (Ptr WebsocketConnection)
{- |
Creates a 'GI.Soup.Objects.WebsocketConnection.WebsocketConnection' on /@stream@/. This should be
called after completing the handshake to begin using the WebSocket
protocol.
/Since: 2.50/
-}
websocketConnectionNew ::
(B.CallStack.HasCallStack, MonadIO m, Gio.IOStream.IsIOStream a) =>
a
{- ^ /@stream@/: a 'GI.Gio.Objects.IOStream.IOStream' connected to the WebSocket server -}
-> Soup.URI.URI
{- ^ /@uri@/: the URI of the connection -}
-> Soup.Enums.WebsocketConnectionType
{- ^ /@type@/: the type of connection (client\/side) -}
-> Maybe (T.Text)
{- ^ /@origin@/: the Origin of the client -}
-> Maybe (T.Text)
{- ^ /@protocol@/: the subprotocol in use -}
-> m WebsocketConnection
{- ^ __Returns:__ a new 'GI.Soup.Objects.WebsocketConnection.WebsocketConnection' -}
websocketConnectionNew stream uri type_ origin protocol = liftIO $ do
stream' <- unsafeManagedPtrCastPtr stream
uri' <- unsafeManagedPtrGetPtr uri
let type_' = (fromIntegral . fromEnum) type_
maybeOrigin <- case origin of
Nothing -> return nullPtr
Just jOrigin -> do
jOrigin' <- textToCString jOrigin
return jOrigin'
maybeProtocol <- case protocol of
Nothing -> return nullPtr
Just jProtocol -> do
jProtocol' <- textToCString jProtocol
return jProtocol'
result <- soup_websocket_connection_new stream' uri' type_' maybeOrigin maybeProtocol
checkUnexpectedReturnNULL "websocketConnectionNew" result
result' <- (wrapObject WebsocketConnection) result
touchManagedPtr stream
touchManagedPtr uri
freeMem maybeOrigin
freeMem maybeProtocol
return result'
#if ENABLE_OVERLOADING
#endif
-- method WebsocketConnection::close
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "code", argType = TBasicType TUInt16, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "close code", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "close data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_close" soup_websocket_connection_close ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
Word16 -> -- code : TBasicType TUInt16
CString -> -- data : TBasicType TUTF8
IO ()
{- |
Close the connection in an orderly fashion.
Note that until the 'GI.Soup.Objects.WebsocketConnection.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/
-}
websocketConnectionClose ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> Word16
{- ^ /@code@/: close code -}
-> Maybe (T.Text)
{- ^ /@data@/: close data -}
-> m ()
websocketConnectionClose self code data_ = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
maybeData_ <- case data_ of
Nothing -> return nullPtr
Just jData_ -> do
jData_' <- textToCString jData_
return jData_'
soup_websocket_connection_close self' code maybeData_
touchManagedPtr self
freeMem maybeData_
return ()
#if ENABLE_OVERLOADING
data WebsocketConnectionCloseMethodInfo
instance (signature ~ (Word16 -> Maybe (T.Text) -> m ()), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionCloseMethodInfo a signature where
overloadedMethod _ = websocketConnectionClose
#endif
-- method WebsocketConnection::get_close_code
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_close_code" soup_websocket_connection_get_close_code ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO Word16
{- |
Get the close code received from the WebSocket peer.
This only becomes valid once the WebSocket is in the
'GI.Soup.Enums.WebsocketStateClosed' state. The value will often be in the
'GI.Soup.Enums.WebsocketCloseCode' enumeration, but may also be an application
defined close code.
/Since: 2.50/
-}
websocketConnectionGetCloseCode ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m Word16
{- ^ __Returns:__ the close code or zero. -}
websocketConnectionGetCloseCode self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_close_code self'
touchManagedPtr self
return result
#if ENABLE_OVERLOADING
data WebsocketConnectionGetCloseCodeMethodInfo
instance (signature ~ (m Word16), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetCloseCodeMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetCloseCode
#endif
-- method WebsocketConnection::get_close_data
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_close_data" soup_websocket_connection_get_close_data ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO CString
{- |
Get the close data received from the WebSocket peer.
This only becomes valid once the WebSocket is in the
'GI.Soup.Enums.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/
-}
websocketConnectionGetCloseData ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m T.Text
{- ^ __Returns:__ the close data or 'Nothing' -}
websocketConnectionGetCloseData self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_close_data self'
checkUnexpectedReturnNULL "websocketConnectionGetCloseData" result
result' <- cstringToText result
touchManagedPtr self
return result'
#if ENABLE_OVERLOADING
data WebsocketConnectionGetCloseDataMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetCloseDataMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetCloseData
#endif
-- method WebsocketConnection::get_connection_type
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "WebsocketConnectionType"}))
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_connection_type" soup_websocket_connection_get_connection_type ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO CUInt
{- |
Get the connection type (client\/server) of the connection.
/Since: 2.50/
-}
websocketConnectionGetConnectionType ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m Soup.Enums.WebsocketConnectionType
{- ^ __Returns:__ the connection type -}
websocketConnectionGetConnectionType self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_connection_type self'
let result' = (toEnum . fromIntegral) result
touchManagedPtr self
return result'
#if ENABLE_OVERLOADING
data WebsocketConnectionGetConnectionTypeMethodInfo
instance (signature ~ (m Soup.Enums.WebsocketConnectionType), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetConnectionTypeMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetConnectionType
#endif
-- method WebsocketConnection::get_io_stream
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gio", name = "IOStream"}))
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_io_stream" soup_websocket_connection_get_io_stream ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO (Ptr Gio.IOStream.IOStream)
{- |
Get the I\/O stream the WebSocket is communicating over.
/Since: 2.50/
-}
websocketConnectionGetIoStream ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m Gio.IOStream.IOStream
{- ^ __Returns:__ the WebSocket\'s I\/O stream. -}
websocketConnectionGetIoStream self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_io_stream self'
checkUnexpectedReturnNULL "websocketConnectionGetIoStream" result
result' <- (newObject Gio.IOStream.IOStream) result
touchManagedPtr self
return result'
#if ENABLE_OVERLOADING
data WebsocketConnectionGetIoStreamMethodInfo
instance (signature ~ (m Gio.IOStream.IOStream), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetIoStreamMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetIoStream
#endif
-- method WebsocketConnection::get_keepalive_interval
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt)
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_keepalive_interval" soup_websocket_connection_get_keepalive_interval ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO Word32
{- |
Gets the keepalive interval in seconds or 0 if disabled.
/Since: 2.58/
-}
websocketConnectionGetKeepaliveInterval ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m Word32
{- ^ __Returns:__ the keepalive interval. -}
websocketConnectionGetKeepaliveInterval self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_keepalive_interval self'
touchManagedPtr self
return result
#if ENABLE_OVERLOADING
data WebsocketConnectionGetKeepaliveIntervalMethodInfo
instance (signature ~ (m Word32), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetKeepaliveIntervalMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetKeepaliveInterval
#endif
-- method WebsocketConnection::get_max_incoming_payload_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt64)
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_max_incoming_payload_size" soup_websocket_connection_get_max_incoming_payload_size ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO Word64
{- |
Gets the maximum payload size allowed for incoming packets.
/Since: 2.56/
-}
websocketConnectionGetMaxIncomingPayloadSize ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m Word64
{- ^ __Returns:__ the maximum payload size. -}
websocketConnectionGetMaxIncomingPayloadSize self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_max_incoming_payload_size self'
touchManagedPtr self
return result
#if ENABLE_OVERLOADING
data WebsocketConnectionGetMaxIncomingPayloadSizeMethodInfo
instance (signature ~ (m Word64), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetMaxIncomingPayloadSizeMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetMaxIncomingPayloadSize
#endif
-- method WebsocketConnection::get_origin
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_origin" soup_websocket_connection_get_origin ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO CString
{- |
Get the origin of the WebSocket.
/Since: 2.50/
-}
websocketConnectionGetOrigin ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m (Maybe T.Text)
{- ^ __Returns:__ the origin, or 'Nothing' -}
websocketConnectionGetOrigin self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_origin self'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr self
return maybeResult
#if ENABLE_OVERLOADING
data WebsocketConnectionGetOriginMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetOriginMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetOrigin
#endif
-- method WebsocketConnection::get_protocol
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_protocol" soup_websocket_connection_get_protocol ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO CString
{- |
Get the protocol chosen via negotiation with the peer.
/Since: 2.50/
-}
websocketConnectionGetProtocol ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m (Maybe T.Text)
{- ^ __Returns:__ the chosen protocol, or 'Nothing' -}
websocketConnectionGetProtocol self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_protocol self'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- cstringToText result'
return result''
touchManagedPtr self
return maybeResult
#if ENABLE_OVERLOADING
data WebsocketConnectionGetProtocolMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetProtocolMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetProtocol
#endif
-- method WebsocketConnection::get_state
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "WebsocketState"}))
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_state" soup_websocket_connection_get_state ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO CUInt
{- |
Get the current state of the WebSocket.
/Since: 2.50/
-}
websocketConnectionGetState ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m Soup.Enums.WebsocketState
{- ^ __Returns:__ the state -}
websocketConnectionGetState self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_state self'
let result' = (toEnum . fromIntegral) result
touchManagedPtr self
return result'
#if ENABLE_OVERLOADING
data WebsocketConnectionGetStateMethodInfo
instance (signature ~ (m Soup.Enums.WebsocketState), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetStateMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetState
#endif
-- method WebsocketConnection::get_uri
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Soup", name = "URI"}))
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_get_uri" soup_websocket_connection_get_uri ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
IO (Ptr Soup.URI.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/
-}
websocketConnectionGetUri ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> m Soup.URI.URI
{- ^ __Returns:__ the URI -}
websocketConnectionGetUri self = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
result <- soup_websocket_connection_get_uri self'
checkUnexpectedReturnNULL "websocketConnectionGetUri" result
result' <- (newBoxed Soup.URI.URI) result
touchManagedPtr self
return result'
#if ENABLE_OVERLOADING
data WebsocketConnectionGetUriMethodInfo
instance (signature ~ (m Soup.URI.URI), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionGetUriMethodInfo a signature where
overloadedMethod _ = websocketConnectionGetUri
#endif
-- method WebsocketConnection::send_binary
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "data", argType = TCArray False (-1) 2 (TBasicType TUInt8), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message contents", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : [Arg {argCName = "length", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the length of @data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_send_binary" soup_websocket_connection_send_binary ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
Ptr Word8 -> -- data : TCArray False (-1) 2 (TBasicType TUInt8)
Word64 -> -- length : TBasicType TUInt64
IO ()
{- |
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/
-}
websocketConnectionSendBinary ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> ByteString
{- ^ /@data@/: the message contents -}
-> m ()
websocketConnectionSendBinary self data_ = liftIO $ do
let length_ = fromIntegral $ B.length data_
self' <- unsafeManagedPtrCastPtr self
data_' <- packByteString data_
soup_websocket_connection_send_binary self' data_' length_
touchManagedPtr self
freeMem data_'
return ()
#if ENABLE_OVERLOADING
data WebsocketConnectionSendBinaryMethodInfo
instance (signature ~ (ByteString -> m ()), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionSendBinaryMethodInfo a signature where
overloadedMethod _ = websocketConnectionSendBinary
#endif
-- method WebsocketConnection::send_text
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "text", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the message contents", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_send_text" soup_websocket_connection_send_text ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
CString -> -- text : TBasicType TUTF8
IO ()
{- |
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/
-}
websocketConnectionSendText ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> T.Text
{- ^ /@text@/: the message contents -}
-> m ()
websocketConnectionSendText self text = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
text' <- textToCString text
soup_websocket_connection_send_text self' text'
touchManagedPtr self
freeMem text'
return ()
#if ENABLE_OVERLOADING
data WebsocketConnectionSendTextMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionSendTextMethodInfo a signature where
overloadedMethod _ = websocketConnectionSendText
#endif
-- method WebsocketConnection::set_keepalive_interval
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "interval", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the interval to send a ping message or 0 to disable it", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_set_keepalive_interval" soup_websocket_connection_set_keepalive_interval ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
Word32 -> -- interval : TBasicType TUInt
IO ()
{- |
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/
-}
websocketConnectionSetKeepaliveInterval ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> Word32
{- ^ /@interval@/: the interval to send a ping message or 0 to disable it -}
-> m ()
websocketConnectionSetKeepaliveInterval self interval = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
soup_websocket_connection_set_keepalive_interval self' interval
touchManagedPtr self
return ()
#if ENABLE_OVERLOADING
data WebsocketConnectionSetKeepaliveIntervalMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionSetKeepaliveIntervalMethodInfo a signature where
overloadedMethod _ = websocketConnectionSetKeepaliveInterval
#endif
-- method WebsocketConnection::set_max_incoming_payload_size
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "Soup", name = "WebsocketConnection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the WebSocket", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "max_incoming_payload_size", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the maximum payload size", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "soup_websocket_connection_set_max_incoming_payload_size" soup_websocket_connection_set_max_incoming_payload_size ::
Ptr WebsocketConnection -> -- self : TInterface (Name {namespace = "Soup", name = "WebsocketConnection"})
Word64 -> -- max_incoming_payload_size : TBasicType TUInt64
IO ()
{- |
Sets the maximum payload size allowed for incoming packets. It
does not limit the outgoing packet size.
/Since: 2.56/
-}
websocketConnectionSetMaxIncomingPayloadSize ::
(B.CallStack.HasCallStack, MonadIO m, IsWebsocketConnection a) =>
a
{- ^ /@self@/: the WebSocket -}
-> Word64
{- ^ /@maxIncomingPayloadSize@/: the maximum payload size -}
-> m ()
websocketConnectionSetMaxIncomingPayloadSize self maxIncomingPayloadSize = liftIO $ do
self' <- unsafeManagedPtrCastPtr self
soup_websocket_connection_set_max_incoming_payload_size self' maxIncomingPayloadSize
touchManagedPtr self
return ()
#if ENABLE_OVERLOADING
data WebsocketConnectionSetMaxIncomingPayloadSizeMethodInfo
instance (signature ~ (Word64 -> m ()), MonadIO m, IsWebsocketConnection a) => O.MethodInfo WebsocketConnectionSetMaxIncomingPayloadSizeMethodInfo a signature where
overloadedMethod _ = websocketConnectionSetMaxIncomingPayloadSize
#endif