You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: CHANGELOG.md
+7-1
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,15 @@
1
1
# CHANGELOG
2
2
3
+
## 0.10.0.0
4
+
5
+
- Add `PGWS_META_CHANNEL` to configure optional metadata channel to send events from the server. Initially the oply event is `ConnectionOpen`.
6
+
- Add property `event` to message JSON. Two possible values so far: `ConnectionOpen` and `WebsocketMessage`.
7
+
- Breaking change: the property `channel` is not appended to claims anymore. If `channel` is in the original token claims it will still be present.
8
+
3
9
## 0.9.0.0
4
10
5
11
- Add @filename semantics to PGWS_DB_URI configiration variable to allow secret management to use a file instead of an environment variable.
6
-
- Add PGWS_RETRIES to limit the amount of times the server tries to open a database connection upon startup (defaults to 5). This breaks backward compatibility if you rely on the behaviour of the server to try infitite times.
12
+
- Add `PGWS_RETRIES` to limit the amount of times the server tries to open a database connection upon startup (defaults to 5). This breaks backward compatibility if you rely on the behaviour of the server to try infitite times.
Where `postgres-websockets-listener` is the database channel used by your instance of postgres-websockets and `chat` is the channel where the browser is connected (the same issued in the JWT used to connect).
118
+
119
+
## Monitoring Connections
120
+
121
+
To monitor connection opening one should set the variable `PGWS_META_CHANNEL` which will enable the meta-data messages generation in the server on the channel name specified.
122
+
For instamce, if we use the configuration in the [sample-env](./sample-env) we will see messages like the one bellow each time a connection is estabilished (only after the JWT is validated).
You can monitor these messages on another websocket connection with a proper read token for the channel `server-info` or also having an additional database listener on the `PGWS_LISTEN_CHANNEL`.
Copy file name to clipboardexpand all lines: src/PostgresWebsockets/Config.hs
+2
Original file line number
Diff line number
Diff line change
@@ -31,6 +31,7 @@ data AppConfig = AppConfig {
31
31
, configHost::Text
32
32
, configPort::Int
33
33
, configListenChannel::Text
34
+
, configMetaChannel::MaybeText
34
35
, configJwtSecret::ByteString
35
36
, configJwtSecretIsBase64::Bool
36
37
, configPool::Int
@@ -68,6 +69,7 @@ readOptions =
68
69
<*> var str "PGWS_HOST" (def "*4"<> helpDef show<> help "Address the server will listen for websocket connections")
69
70
<*> var auto "PGWS_PORT" (def 3000<> helpDef show<> help "Port the server will listen for websocket connections")
70
71
<*> var str "PGWS_LISTEN_CHANNEL" (def "postgres-websockets-listener"<> helpDef show<> help "Master channel used in the database to send or read messages in any notification channel")
72
+
<*> optional (var str "PGWS_META_CHANNEL" (help "Websockets channel used to send events about the server state changes."))
71
73
<*> var str "PGWS_JWT_SECRET" (help "Secret used to sign JWT tokens used to open communications channels")
72
74
<*> var auto "PGWS_JWT_SECRET_BASE64" (def False<> helpDef show<> help "Indicate whether the JWT secret should be decoded from a base64 encoded string")
73
75
<*> var auto "PGWS_POOL_SIZE" (def 10<> helpDef show<> help "How many connection to the database should be used by the connection pool")
--| Given a configuration and a shutdown action (performed when the Multiplexer's listen connection dies) produces the context necessary to run sessions
0 commit comments