How to verify that 'frappe.publish_realtime()' has actually published something?

I have successfully got a functioning NodeJS/Express app situated in a properly functioning Frappe app.

The next step was to get going with…

frappe.publish_realtime('my_event', {etc})

… in the Frappe app and with …

var subscriber = redis.createClient();
subscriber.on("my_event", function (channel, message) {  etc, etc })

… running in the NodeJS app.

I used this article to get started : How to get Realtime Updates in your App from ERPNext via and Redis, but it has a bunch of errors, so I don’t think the author (@joshiparthin ?? ) ever tested to be sure he was describing something that functions as advertised.

Meanwhile, I can’t find any evidence in my system that publish_realtime() is actually doing anything at all.

I searched the code and found that chat and blog post both use subscriber.on, but in my development environment neither of those work. :frowning:

There are hints from several years ago that publish_realtime() only works in production mode.

There’s this Github Issue : [ frappe.async.realtime_publish not working] (frappe.async.realtime_publish not working · Issue #1963 · frappe/frappe · GitHub) and there’s this post : Frappe.publish_realtime

My questions are:

How can I see, with logging messages, or similar, if frappe.publish_realtime() is actually publishing my event?

Does publish_realtime() NOT work in development mode?

1 Like

are you running in the debugger mode start the bench using this command

bench start

Its working for me

WebSocket is closed before the connection is established.

This is the error i see in the console. websocket is on 9000 port
working on development server
please help

Please check this tutorial

And share some screen shot its help me to understand the error

Which Version ERPNext your using?

sure i just read that thread but i didnt find anything that could help me

  • Is your machine self hosted?
  • Which version ERPNext your using?
  • Is it running in Docker?

v14 erpnext
manual install (not docker)

I’m using Docker For development its working fine for me. make sure the redis running fine or not

Why your using the redis try the tutorial once i attached above. one more importand. try to run in

bench start

Because I worked without docker also its working fine that time also.