Try ERPNext Buy Support Partners Foundation

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 Socket.io 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] (https://github.com/frappe/frappe/issues/1963) 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?