using frappe.publish_realtime an “event” is triggered (via socket.io), to which you can subscribe in a frontend event as described within https://frappeframework.com/docs/v13/user/en/basics#realtime.
In a similar field, when we have to transmit data to another site, we can implement “event streaming” - then it would be backend-to-backend communication. https://docs.erpnext.com/docs/v13/user/manual/en/automation/event_streaming.
The reason why I am asking: We have very often the situation, that within one document, we show a few information from another document and we would like to make sure, that both “are in sync”.
Example: Within “Customer” we have a custom link and data-field (with fetch-from based on the link-field) implemented, to show eg. a information from the primary Contact of a Customer.
If we would change that information within the Contact, the related field within the Customer would never be updated, as a “fetch-from” will do that only “once” (when selecting a document within the link-field).
My “hope” was, that there is a more elegant approach than implement the update to all “dependent” fields within the onSave-Event of Customer, but instead, just publish an event eg. “Contact field xx updated” and all subscribers can do whatever is necessary… But that would require to subscribe to a event within the backend-part, as we can not rely on a user to have that document open in their browser and therefore the client-event could be implemented…
Is it possible to subscribe to a realtime-Event within the backend?
I guess the answe is “no”, and the best solution would be to directly call a backend method or enqueue a background job during the onSave-event…?
Any ideas to that?