Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor structure of presence updates
This commit changes how we handle updates for presence spaces. An presence update becomes a PresenceMember: export type PresenceMember = { data: { profileUpdate: { id: string | null; current: ProfileData; }; locationUpdate: { id: string | null; previous: unknown; current: unknown; }; }; } & Omit<Types.PresenceMessage, 'data'>; Which then gets translated for the developer to a SpaceMember: export type SpaceMember = { clientId: string; connectionId: string; isConnected: boolean; profileData: ProfileData; location: unknown; lastEvent: { name: Types.PresenceAction; timestamp: number; }; }; data on PresenceMember contains the last update for profileData an location. The current key is the value of these properties on SpaceMember. profileUpdate and locationUpdate contain an id. This id is set on publish, but only when we are providing new data, not copying already set data. The handlers check the id to decide if an update should be emitted (it will still be applied, and it should be the same).
- Loading branch information