For anyone just looking for ‘plug and play’ web socket pub/sub functionality, I have been developing something that provides the functionality for PostgreSQL: <a href="https://github.com/supabase/realtime" rel="nofollow">https://github.com/supabase/realtime</a><p>It's an Elixir server (Phoenix) that allows you to listen to changes in your database via websockets.
Basically the Phoenix server listens to PostgreSQL's replication functionality, converts the byte stream into JSON, and then broadcasts over websockets. The beauty of listening to the replication functionality is that you can make changes to your database from anywhere - your api, directly in the DB, via a console etc - and you will still receive the changes via websockets.<p>The article suggests Postgres’ native LISTEN/NOTIFY functionality. I tried that originally and found that NOTIFY payloads have a limit of 8000 bytes, as well a few other inconveniences.<p>It's still in very early stages, although I am using it in production at my company and will work on it full time starting Jan.