Copyright | (c) digitally induced GmbH 2020 |
---|---|
Safe Haskell | None |
Synopsis
- initAutoRefresh :: (?context :: ControllerContext, ?applicationContext :: ApplicationContext) => IO ()
- autoRefresh :: (?theAction :: action, Controller action, ?modelContext :: ModelContext, ?context :: ControllerContext) => ((?modelContext :: ModelContext) => IO ()) -> IO ()
- data AutoRefreshWSApp
- registerNotificationTrigger :: (?modelContext :: ModelContext) => IORef (Set ByteString) -> IORef AutoRefreshServer -> IO ()
- getAvailableSessions :: (?context :: ControllerContext) => IORef AutoRefreshServer -> IO [UUID]
- getSessionById :: (?applicationContext :: ApplicationContext) => UUID -> IO AutoRefreshSession
- updateSession :: (?applicationContext :: ApplicationContext) => UUID -> (AutoRefreshSession -> AutoRefreshSession) -> IO ()
- gcSessions :: IORef AutoRefreshServer -> IO ()
- isSessionExpired :: UTCTime -> AutoRefreshSession -> Bool
- channelName :: ByteString -> ByteString
- notificationTrigger :: ByteString -> Query
Documentation
initAutoRefresh :: (?context :: ControllerContext, ?applicationContext :: ApplicationContext) => IO () Source #
autoRefresh :: (?theAction :: action, Controller action, ?modelContext :: ModelContext, ?context :: ControllerContext) => ((?modelContext :: ModelContext) => IO ()) -> IO () Source #
data AutoRefreshWSApp Source #
Instances
WSApp AutoRefreshWSApp Source # | |
Defined in IHP.AutoRefresh |
registerNotificationTrigger :: (?modelContext :: ModelContext) => IORef (Set ByteString) -> IORef AutoRefreshServer -> IO () Source #
getAvailableSessions :: (?context :: ControllerContext) => IORef AutoRefreshServer -> IO [UUID] Source #
Returns the ids of all sessions available to the client based on what sessions are found in the session cookie
getSessionById :: (?applicationContext :: ApplicationContext) => UUID -> IO AutoRefreshSession Source #
Returns a session for a given session id. Errors in case the session does not exist.
updateSession :: (?applicationContext :: ApplicationContext) => UUID -> (AutoRefreshSession -> AutoRefreshSession) -> IO () Source #
Applies a update function to a session specified by its session id
gcSessions :: IORef AutoRefreshServer -> IO () Source #
Removes all expired sessions
This is useful to avoid dead sessions hanging around. This can happen when a websocket connection was never established after the initial request. Then the onClose of the websocket app is never called and thus the session will not be removed automatically.
isSessionExpired :: UTCTime -> AutoRefreshSession -> Bool Source #
A session is expired if it was not pinged in the last 60 seconds
channelName :: ByteString -> ByteString Source #
Returns the event name of the event that the pg notify trigger dispatches
notificationTrigger :: ByteString -> Query Source #
Returns the sql code to set up a database trigger