Frappe.publish_realtime() not working


I can’t get frappe.publish_realtime() to do anything. I’ve been browsing the forums for the last several hours, but I haven’t uncovered any leads that help me figure out what’s going wrong.

I have this code on the server:

                        {'task_id': 1, 'foo': 'bar'},

On the client, I have this:

console.log('setup realtime');
frappe.realtime.on('gang_process', (data) => {
    console.log('data', data);

Both code blocks trigger when I press a button. I expect to see this in the browser console:

setup realtime
data {'task_id': 1, 'foo': 'bar'}

in the browser console, as well as a frappe message box with the word “past” in it. All I see is setup realtime and the messagebox, with no indication error or indication of any kind that frappe.publish_realtime() did anything at all.


I’m running ERPNext 12 in development mode. On the suggestion from one of the forums, I ran

bench setup socketio
bench build

after which I restarted the server and refreshed the page. Nothing changed.

Any help would be appreciated!

1 Like

Is anyone familiar with the publish_realtime API able to help me? This is a bit of a mystery to me, especially since the notifications appear that indicate when other people are viewing a document you have open.

I don’t have anything useful to say other than that I’ve also really struggled to get this working. I’m following this thread with interest!

I also have not successfully used publish_realtime, but would like to.

As per my knowledge, it doesn’t work in developer mode.

That’s a dead link:

The old developer forums were either completely removed, or exist somewhere I don’t know about.

remove sites/currentsite.txt file

rm sites/currentsite.txt

add site names to /etc/hosts, or just use sites ending with .localhost.

And it’ll work. It needs to identify site name from request headers for socketio to work


I am running in production mode by set
bench set-config -g developer_mode 0
and bench start.
still i don’t get any response in
frappe.realtime.on(‘gang_process’, (data) => {
console.log(‘data’, data);

in version 14 of erpnext

@revant_one the steps you suggested arent working, could you please revise the steps once again?

1 Like