I set up a websocket connection using this example https://ihp.digitallyinduced.com/Guide/websockets.html
Would it be possible to track certain DB tables here as well? Like AutoRefresh is doing for actions. I want to push something over WS when a table is updates/inserted. I understand that is what autorefresh is doing, but i'm trying to use this as a backend to backend communication, and autorefresh seems to require an action
Thanks! I'll check it out :) will update if i make it work!
Interestingly the documentations shows how to listen for changes from javascript, but not how to do it from within Haskell. So it is definitely possible, i just need to find the haskell side code of the ws connection
You can find the DB watcher code for DataSync starting here: https://github.com/digitallyinduced/ihp/blob/master/IHP/DataSync/Controller.hs#L76
You need to do two things:
subscribe
or subscribeJSON
(this automatically decodes the response the postgres event as json). https://github.com/digitallyinduced/ihp/blob/master/IHP/DataSync/Controller.hs#L114
Maybe DataSync could be for you? https://ihp.digitallyinduced.com/Guide/realtime-spas.html
It lets you subscribe to certain database tables like for example this through JavaScript: