How does the server proactively send UNO commands to the client

My scenario is like this: I added a document modification listener XDDocumentEventListener using Python interface on a Word document. When the document changes, I want to send it to all current collaborative editing users and tell them what the modified document content is

Your Python script uses the UNO API of the core.git code and there is no UNO API for emitting LOK API callbacks, so you can’t do that directly.

However, what you can do is that once you modify the document, all editing users will receive a notification that the state of the UNO command responsible for the modification status has changed. This also results in a postmessage API call, see PostMessage API — SDK https://sdk.collaboraonline.com/ documentation – it’s something you can listen for in your integration of COOL.

At this point you can run a server-side python script that e.g. selects the entire document and send the plain text version of the selection or something like that.