feat(realtime): push channel.joined/left events to user-scoped rooms #1
Reference in New Issue
Block a user
Delete Branch "feat/push-channel-membership-events"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Backend half of push-based membership sync (companion to OpenClaw fabric plugin). Before: clients learned about new channel membership only by re-polling
/api/channels?guildId=.... Now the server emits realtime events on every membership change.Changes
realtime.gateway.ts:handleConnectionjoins each socket into auser:<userId>roomemitToUser(userId, event, data)helper that emits into that room (no-op for offline users)channels.service.ts:RealtimeGateway(RealtimeModule is@Global, no module plumbing)notifyMembership(kind, channelId, userIds, extra)helper emitschannel.<kind>payload{channelId, userId, xType, occurredAt}create(): emitchannel.joinedto every seeded member (creator + invitees + triage on-duty)joinChannel(): emit on actual insert only (idempotent)leaveChannel(): emit on actual delete onlyVerified in sim
T0 (channel create with member) 07:11:31.569 → T1 (plugin push recv) 07:11:31.791 = 222ms.
T0 (leave channel) 07:12:08.323 → T1 (plugin push recv) 07:12:08.788 = 465ms.
vs prior polling worst-case 60s.
🤖 Generated with Claude Code