diff --git a/packages/client/src/withAutomerge.ts b/packages/client/src/withAutomerge.ts index e5b9109..b91d1bb 100644 --- a/packages/client/src/withAutomerge.ts +++ b/packages/client/src/withAutomerge.ts @@ -45,8 +45,6 @@ const withAutomerge = ( e.connection.open() } - createConnection() - /** * Open Automerge Connection */ diff --git a/packages/client/src/withSocketIO.ts b/packages/client/src/withSocketIO.ts index 91ae2ae..a93c4fc 100644 --- a/packages/client/src/withSocketIO.ts +++ b/packages/client/src/withSocketIO.ts @@ -7,7 +7,6 @@ import { CollabAction } from '@hiveteams/collab-bridge' export interface SocketIOPluginOptions { url: string connectOpts: SocketIOClient.ConnectOpts - autoConnect?: boolean onConnect?: () => void onDisconnect?: () => void @@ -38,31 +37,22 @@ const withSocketIO = ( const e = editor as T & WithSocketIOEditor let socket: SocketIOClient.Socket - const { - onConnect, - onDisconnect, - onError, - connectOpts, - url, - autoConnect - } = options + const { onConnect, onDisconnect, onError, connectOpts, url } = options /** * Connect to Socket. */ e.connect = () => { - if (!socket) { - socket = io(url, { ...connectOpts }) + socket = io(url, { ...connectOpts }) - socket.on('connect', () => { - e.clientId = socket.id + socket.on('connect', () => { + e.clientId = socket.id - e.openConnection() + e.openConnection() - onConnect && onConnect() - }) - } + onConnect && onConnect() + }) socket.on('error', (msg: string) => { onError && onError(msg) @@ -127,8 +117,6 @@ const withSocketIO = ( e.closeConnection() } - autoConnect && e.connect() - return e }