From a845cd182e562a4bb4a69a0a960201279cc316f1 Mon Sep 17 00:00:00 2001 From: Carlos Santos Date: Sun, 2 Jun 2024 11:20:19 -0300 Subject: [PATCH] feat: recieves messages sended by http method --- package.json | 2 +- src/components/realtime/channel.ts | 2 +- src/components/realtime/types.ts | 2 +- src/core/index.ts | 2 +- yarn.lock | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 129b9efd..3c582f5c 100644 --- a/package.json +++ b/package.json @@ -78,7 +78,7 @@ "yargs": "^17.7.2" }, "dependencies": { - "@superviz/socket-client": "1.4.0", + "@superviz/socket-client": "1.5.1", "ably": "^1.2.45", "bowser": "^2.11.0", "bowser-jr": "^1.0.6", diff --git a/src/components/realtime/channel.ts b/src/components/realtime/channel.ts index 038527fd..a60f88d7 100644 --- a/src/components/realtime/channel.ts +++ b/src/components/realtime/channel.ts @@ -133,7 +133,7 @@ export class Channel extends Observable { this.logger.log('message received', event); this.publishEventToClient(event.data.name, { data: event.data.payload, - participantId: event.presence.id, + participantId: event?.presence?.id || null, name: event.data.name, timestamp: event.timestamp, } as RealtimeMessage); diff --git a/src/components/realtime/types.ts b/src/components/realtime/types.ts index d0ce95a0..e755ff6f 100644 --- a/src/components/realtime/types.ts +++ b/src/components/realtime/types.ts @@ -25,7 +25,7 @@ export type RealtimeData = { export type RealtimeMessage = { name: string; connectionId: string; - participantId: string; + participantId: string | null; data: unknown; timestamp: number; }; diff --git a/src/core/index.ts b/src/core/index.ts index 77893f99..1fd25576 100644 --- a/src/core/index.ts +++ b/src/core/index.ts @@ -141,7 +141,7 @@ const init = async (apiKey: string, options: SuperVizSdkOptions): Promise