Chat Gateway - Real-time Communication
message:delivered and message:received
include a post object (with postMedia)
or sharedProfile user object instead of
story. Push notification type is
sharedPost or sharedProfile.
chatUniqueId in the payload). For each successful recipient, the server runs the same delivery flow
as private:message.
message:delivered (sender),
message:received (recipient),
last:message (both), plus push notification with type
sharedPost or sharedProfile.
uId).
bulk:share → Server resolves recipients in batch →
Creates or finds chats → Inserts messages → For each success, emits the same events as
private:message → Emits bulk:share:completed to sender with succeeded
and failed lists
emitUserBlocked() method → Event emitted to User B's socket room (uId) →
User B receives notification about block status change. The blocked user can use this to update their UI
(disable messaging, show blocked status, etc.). Only the blocked user receives this notification, not the
blocker.
status:online with senderUId and receiverUId →
Server checks receiver's online status from database →
Server emits status:online response only to the sender →
Sender updates UI (Online / Offline / Last Seen).
user:blocked event with senderUId and receiverUId →
Server checks if user is blocked → Server emits user:blocked response only to the sender → Sender
updates UI (block status).
emitDeleteUser() method → Event
emitted to all connected users → All users receive notification about user deletion.
user:deleted event with senderUId and receiverUId →
Server checks if user is deleted → Server emits user:deleted response only to the sender → Sender
updates UI (delete status).