graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.GraphQL.Transport.WebSocket.Server

Synopsis

Documentation

newtype WSId Source #

Constructors

WSId 

Fields

Instances

Instances details
Eq WSId Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

(==) :: WSId -> WSId -> Bool #

(/=) :: WSId -> WSId -> Bool #

Show WSId Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

showsPrec :: Int -> WSId -> ShowS #

show :: WSId -> String #

showList :: [WSId] -> ShowS #

Hashable WSId Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

hashWithSalt :: Int -> WSId -> Int

hash :: WSId -> Int

ToJSON WSId Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

toJSON :: WSId -> Value

toEncoding :: WSId -> Encoding

toJSONList :: [WSId] -> Value

toEncodingList :: [WSId] -> Encoding

data MessageDetails Source #

Websocket message and other details

Instances

Instances details
Show MessageDetails Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

ToJSON MessageDetails Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

toJSON :: MessageDetails -> Value

toEncoding :: MessageDetails -> Encoding

toJSONList :: [MessageDetails] -> Value

toEncodingList :: [MessageDetails] -> Encoding

data WSLog Source #

Instances

Instances details
Show WSLog Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

showsPrec :: Int -> WSLog -> ShowS #

show :: WSLog -> String #

showList :: [WSLog] -> ShowS #

ToJSON WSLog Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

toJSON :: WSLog -> Value

toEncoding :: WSLog -> Encoding

toJSONList :: [WSLog] -> Value

toEncodingList :: [WSLog] -> Encoding

ToEngineLog WSLog Hasura Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

class Monad m => MonadWSLog m where Source #

Methods

logWSLog :: Logger Hasura -> WSLog -> m () Source #

Takes WS server log data and logs it logWSServer

Instances

Instances details
MonadIO m => MonadWSLog (PGMetadataStorageAppT m) Source # 
Instance details

Defined in Hasura.App

MonadWSLog m => MonadWSLog (ExceptT e m) Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

logWSLog :: Logger Hasura -> WSLog -> ExceptT e m () Source #

MonadWSLog m => MonadWSLog (ReaderT r m) Source # 
Instance details

Defined in Hasura.GraphQL.Transport.WebSocket.Server

Methods

logWSLog :: Logger Hasura -> WSLog -> ReaderT r m () Source #

data WSQueueResponse Source #

Constructors

WSQueueResponse 

Fields

data WSConn a Source #

Constructors

WSConn 

Fields

forceConnReconnect :: MonadIO m => WSConn a -> ByteString -> m () Source #

Closes a connection with code 1012, which means "Server is restarting" good clients will implement a retry logic with a backoff of a few seconds

type ConnMap a = Map WSId (WSConn a) Source #

data WSServer a Source #

Constructors

WSServer 

Fields

closeAllWith :: (ByteString -> WSConn a -> IO ()) -> ByteString -> [(WSId, WSConn a)] -> IO () Source #

flushConnMap :: TVar (ServerStatus a) -> STM [(WSId, WSConn a)] Source #

Resets the current connections map to an empty one if the server is running and returns the list of connections that were in the map before flushing it.

data AcceptWith a Source #

Constructors

AcceptWith 

Fields

type WSKeepAliveMessageAction a = WSConn a -> IO () Source #

These set of functions or message handlers is used by the server while communicating with the client. They are particularly useful for the case when the messages being sent to the client are different for each of the sub-protocol(s) supported by the server.

data WSActions a Source #

Used for specific actions within the onConn and onMessage handlers

Constructors

WSActions 

Fields

type OnConnH m a = WSId -> RequestHead -> IpAddress -> WSActions a -> m (Either RejectRequest (AcceptWith a)) Source #

type OnCloseH m a = WSConn a -> m () Source #

type HasuraServerApp m = IpAddress -> PendingConnection -> m () Source #

aka generalized ServerApp over m, which takes an IPAddress

data WSHandlers m a Source #

NOTE: The types of _hOnConn and _hOnMessage were updated from OnConnH and OnMessageH because we needed to pass the subprotcol here to these methods to eventually get to OnConnH and OnMessageH. Please see createServerApp to get a better understanding of how these handlers are used.

Constructors

WSHandlers 

Fields

createServerApp Source #

Arguments

:: (MonadIO m, MonadBaseControl IO m, Forall (Pure m), MonadWSLog m) 
=> WSConnectionInitTimeout 
-> WSServer a 
-> WSHandlers m a

user provided handlers

-> HasuraServerApp m

aka WS.ServerApp