KamoCRM

Let a caller own the realtime announcement of the message it is still building

Fixkamo-shared-library
Shipped
6 ஆகஸ்ட், 2026 அன்று 10:06 PM UTC
Author
Kamo
Commit
1a71a42

createMessage announced every new message on the session's realtime subject the moment the row was saved — inside the caller's transaction, before the caller had written anything else. For a chat message with an attachment that is too early to be true: the announcement went out with no attachments, and MediaController's own complete announcement followed ~60ms later, after the attachment rows committed. Subscribers keep the first event they see for a message id, so the incomplete one is the one that stuck; the image stayed missing from the message until the page was reloaded. The same race mislabels a social visitor's reply, which this method can only announce as messageType=MESSAGE while SocialMessageService announces it as SOCIAL_VISITOR. Callers that finish building the message themselves now pass publishRealtimeEvent=false and announce it once, when it is whole. Callers that don't publish their own event — the social feed, media streams — are unaffected.

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing