Closed W1M0R closed 4 years ago
@W1M0R what would be the difference between disabling echo and opening a channel in mode w
?
The echo is just a consequence of listening to the same broadcast channel we are writing to, we would have to write additional code to filter out messages issued by a particular client. If you could solve your case by opening a write only channel for the messages you don't want the echo and another channel to listen to incoming messages from the database that might be a better approach.
Your suggested approach makes sense and will sufficiently solve my use case. Now I understand the purpose of the mode field. Thanks.
When I send a websocket message from the browser to postgres-websockets, the websocket responds with an echo of what I sent, including the payload and additional properties such as
message_delivered_at
. If big payloads are sent, then having them echoed in response can be detrimental to performance.Having the websocket echo an acknowledgement is great, but can we have the option to disable the acknowledgement, or to redact the payload (and potentially the claims) from it? This feature may be implemented by providing additional claims in the JWT that will be honoured by postgres-websockets, e.g.
echoPayload: false
, etc.If you find the JWT approach good and expect to implement other features in a similar way, then it might be a good idea to put the claims in a JWT key that serves as a namespace for all future postgres-websockets claims, e.g.
Alternatively, it could be a global configuration setting for postgres-websockets. I'm note sure how pg-recorder is able to respond to messages sent to postgres-websockets, but I suspect it relies on the fact that the payload is echoed to connected clients.