How does it works
Speculare PGCDC transform the Postgres instance in a real-time capable database using the logical replication functionnality built in Postgres.
Postgres versions 9.6, 10, 11, 12 and 13 should be supported. But only the version 13 is tested.
You probably know that Postgresql is not a realtime databse. So if we want to stream the changes of it to a websocket or any UI it's not possible by default (other than polling the database constantly).
Hopefully Postgresql have that sweet feature named
Logical Replication, which stream the change made into the database over a replication slot. We can use a multitude of plugins to format the output of this stream, but in our case we've chosen to use wal2json.
This service create a replication slot on the targeted postgres instance and then stream the change from this slot to all the websockets connected.
PGCDC will produce an event for every row-level
INSERT, UPDATE, DELETEthat were captured in the WAL log and sends the event over WebSocket for any client listening to that event (change type and table).