l-min-components 1.0.666 → 1.0.670

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.666",
3
+ "version": "1.0.670",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -306,6 +306,49 @@ const HeaderComponent = (props) => {
306
306
  };
307
307
  }, [websocket]);
308
308
 
309
+ const websocket2 = new WebSocket(
310
+ `wss://${socketUrl}?account=${account_id}&authorization=${token}&room_id=${account_id}`
311
+ );
312
+
313
+
314
+ // websocket for room
315
+ useEffect(() => {
316
+ websocket2.onopen = () => {
317
+ //check if socket is connected
318
+ console.log("room websocket connection established");
319
+ };
320
+
321
+ websocket2.onmessage = (event) => {
322
+ const data = JSON.parse(event.data);
323
+ console.log("websocket data for room", data);
324
+ };
325
+
326
+ const handler = (event) => {
327
+ if (event?.data) {
328
+ const data = JSON.parse(event?.data); //check for incoming message from socket
329
+ if (data.event === "new.notification.result") {
330
+ if (data.data) {
331
+
332
+ }
333
+ }
334
+ if (data.event === "message.new") {
335
+ }
336
+ if (data.event === "new.room.result") {
337
+ console.log(data)
338
+ if (data.status) {
339
+ handleGetUnreadNotification();
340
+ handleGeneralNotificationCount();
341
+ }
342
+ }
343
+ }
344
+ };
345
+ websocket2.addEventListener("message", handler, { passive: true });
346
+
347
+ return () => {
348
+ websocket2.removeEventListener("message", handler);
349
+ console.log("room websocket closed");
350
+ };
351
+ }, [websocket2]);
309
352
 
310
353
  useEffect(() => {
311
354
  if(notificationMarkReadData?.response){