Real-Time Updates for Frappe SPA Frontend

Hi everyone,

I’m currently working on a Frappe-based SPA and trying to implement real-time updates on the frontend (Vue 3 app using the REST API). I’ve explored the built-in frappe.realtime.publish_realtime and frappe.realtime.on, but it appears these only work within the standard Frappe backend or server-rendered pages—not in a separate SPA served independently (e.g., via Vite).

To work around this, I created a custom WebSocket server (using socket.io) on ports like 5200, 6787, etc., and everything works fine locally. However, when I try to deploy this on Frappe Cloud, it seems I can’t run anything on additional ports, which breaks the real-time connection.

I’d love to keep my frontend synced with backend changes without requiring a page refresh or manual polling. Has anyone found a clean and reliable solution for real-time frontend updates in a Frappe SPA on Frappe Cloud?

Any help, ideas, or even hacks would be greatly appreciated.

Thanks in advance!

Check how Frappe HR / CRM did it search for ‘socket’ and do it the same way they did it. It will work perfectly

I got my own custom socket working, the problem is so far it does not seem that there is a way to host additional ports on frappe cloud. The socket works. But it does not seem you can use port 9000 for the custom socket because it is already being used. You have to use a new one. But then again it does not seem you can host additional ports on frappe cloud. I may be wrong and there may be a solution but I can’t seem to figure it out.

Any advice would be amazing!