From 50548ed558f40f1fa95ccbc24ffaa29cc97769ca Mon Sep 17 00:00:00 2001 From: frankpagan Date: Thu, 19 Oct 2023 12:04:09 -0600 Subject: [PATCH] fix: removed @cocreate/message-client --- package.json | 2 +- src/index.js | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index dce5e7a..3bc2688 100644 --- a/package.json +++ b/package.json @@ -60,10 +60,10 @@ }, "dependencies": { "@cocreate/local-storage": "^1.10.5", - "@cocreate/message-client": "^1.8.3", "@cocreate/observer": "^1.11.5", "@cocreate/random-color": "^1.7.2", "@cocreate/selection": "^1.9.4", + "@cocreate/socket-client": "^1.31.0", "@cocreate/utils": "^1.25.3", "@cocreate/uuid": "^1.7.2" } diff --git a/src/index.js b/src/index.js index 3ea3147..5cf772f 100644 --- a/src/index.js +++ b/src/index.js @@ -23,14 +23,14 @@ /*globals ResizeObserver*/ import observer from '@cocreate/observer'; import { getAttributeNames } from '@cocreate/utils'; -import message from '@cocreate/message-client'; +import socket from '@cocreate/socket-client'; import uuid from '@cocreate/uuid'; import localStorage from '@cocreate/local-storage'; import { getElementPosition } from '@cocreate/selection'; import { randomColor } from '@cocreate/random-color'; import './index.css'; -const clientId = message.socket.clientId || uuid.generate(12); +const clientId = socket.clientId || uuid.generate(12); const cursorBackground = randomColor(); let environment_prod = true; @@ -92,7 +92,7 @@ function drawCursors(selection) { elements = document.querySelectorAll(selector); } for (let element of elements) { - if (window.activeElement == element && message.socket.has(selection.socketId)) { + if (window.activeElement == element && socket.has(selection.socketId)) { continue; } let realtime = element.getAttribute('realtime'); @@ -342,8 +342,8 @@ function initResizeObserver(element) { function sendPosition(info) { try { - message.send({ - message: "cursor", + socket.send({ + method: "cursor", data: { array: info.array, object: info.object, @@ -364,8 +364,8 @@ function sendPosition(info) { } -message.listen('cursor', function (response) { - // if (message.socket.has(selection.socketId)) return; +socket.listen('cursor', function (response) { + // if (socket.has(selection.socketId)) return; let selection = response.data selection.socketId = response.socketId if (selection.start != null && selection.end != null)