postgres-websockets 0.11.2.4 → 0.11.2.5
raw patch · 3 files changed
+18/−11 lines, 3 filesdep ~hasqldep ~hasql-notificationsdep ~hasql-pool
Dependency ranges changed: hasql, hasql-notifications, hasql-pool, time
Files
- postgres-websockets.cabal +9/−9
- src/PostgresWebsockets/Context.hs +3/−1
- src/PostgresWebsockets/HasqlBroadcast.hs +6/−1
postgres-websockets.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: postgres-websockets-version: 0.11.2.4+version: 0.11.2.5 synopsis: Middleware to map LISTEN/NOTIFY messages to Websockets description: WAI middleware that adds websockets capabilites on top of PostgreSQL's asynchronous notifications using LISTEN and NOTIFY commands. Fully functioning server included. homepage: https://github.com/diogob/postgres-websockets#readme@@ -44,9 +44,9 @@ , bytestring >= 0.11.5 && < 0.13 , either >= 5.0.1.1 && < 5.1 , envparse >= 0.5.0 && < 0.7- , hasql >= 1.7 && < 1.9- , hasql-notifications >= 0.2.3.0 && < 0.3- , hasql-pool ^>= 1.2+ , hasql >= 1.9 && < 1.10+ , hasql-notifications >= 0.2.4.0 && < 0.3+ , hasql-pool ^>= 1.3 , http-types >= 0.12.3 && < 0.13 , jose >= 0.11 && < 0.12 , lens >= 5.2.3 && < 5.4@@ -57,7 +57,7 @@ , stm >= 2.5.0.0 && < 2.6 , stm-containers >= 1.1.0.2 && < 1.3 , text >= 1.2 && < 2.2- , time >= 1.8.0.2 && < 1.13+ , time >= 1.8.0.2 && < 2 , unordered-containers >= 0.2.19 && < 0.3 , wai >= 3.2 && < 4 , wai-app-static >= 3.1.7.1 && < 3.2@@ -94,11 +94,11 @@ , postgres-websockets , hspec >= 2.7.1 && < 2.12 , aeson >= 2.0 && < 2.3- , hasql >= 1.7 && < 1.9- , hasql-pool ^>= 1.2- , hasql-notifications >= 0.2.3.0 && < 0.3+ , hasql >= 1.9 && < 1.10+ , hasql-pool ^>= 1.3+ , hasql-notifications >= 0.2.4.0 && < 0.3 , http-types >= 0.9- , time >= 1.8.0.2 && < 1.13+ , time >= 1.8.0.2 && < 2 , unordered-containers >= 0.2 , wai-extra >= 3.0.29 && < 3.2 , stm >= 2.5.0.0 && < 2.6
src/PostgresWebsockets/Context.hs view
@@ -16,6 +16,8 @@ import Data.Time.Clock (UTCTime, getCurrentTime) import qualified Hasql.Pool as P import qualified Hasql.Pool.Config as P+import qualified Hasql.Connection.Setting as C+import qualified Hasql.Connection.Setting.Connection as C import PostgresWebsockets.Broadcast (Multiplexer) import PostgresWebsockets.Config (AppConfig (..)) import PostgresWebsockets.HasqlBroadcast (newHasqlBroadcaster)@@ -35,7 +37,7 @@ <*> newHasqlBroadcaster shutdown configListenChannel configRetries configReconnectInterval pgSettings <*> mkGetTime where- config = P.settings [P.staticConnectionSettings pgSettings]+ config = P.settings [P.staticConnectionSettings [C.connection $ C.string $ decodeUtf8 pgSettings]] shutdown = maybe shutdownServer
src/PostgresWebsockets/HasqlBroadcast.hs view
@@ -21,7 +21,10 @@ import qualified Data.Aeson.Key as Key import qualified Data.Aeson.KeyMap as JSON import Data.Either.Combinators (mapBoth)-import Hasql.Connection+import Hasql.Connection (Connection, ConnectionError)+import qualified Hasql.Connection as HC+import qualified Hasql.Connection.Setting as HC+import qualified Hasql.Connection.Setting.Connection as HC import qualified Hasql.Decoders as HD import qualified Hasql.Encoders as HE import Hasql.Notifications@@ -29,6 +32,8 @@ import qualified Hasql.Statement as H import PostgresWebsockets.Broadcast +acquire :: ByteString -> IO (Either ConnectionError Connection)+acquire settings = HC.acquire [HC.connection $ HC.string $ decodeUtf8 settings] -- | Returns a multiplexer from a connection URI, keeps trying to connect in case there is any error. -- This function also spawns a thread that keeps relaying the messages from the database to the multiplexer's listeners newHasqlBroadcaster :: IO () -> Text -> Int -> Maybe Int -> ByteString -> IO Multiplexer