Yuki Takei пре 1 година
родитељ
комит
6ba26e27da
1 измењених фајлова са 6 додато и 2 уклоњено
  1. 6 2
      packages/editor/vite.config.ts

+ 6 - 2
packages/editor/vite.config.ts

@@ -8,7 +8,7 @@ import { Server } from 'socket.io';
 import type { Plugin } from 'vite';
 import { defineConfig } from 'vite';
 import dts from 'vite-plugin-dts';
-
+import { YSocketIO } from 'y-socket.io/dist/server';
 
 const excludeFiles = [
   '**/components/playground/*',
@@ -22,8 +22,8 @@ const devSocketIOPlugin = (): Plugin => ({
   configureServer(server) {
     if (!server.httpServer) return;
 
+    // setup socket.io
     const io = new Server(server.httpServer);
-
     io.on('connection', (socket) => {
       // eslint-disable-next-line no-console
       console.log('Client connected');
@@ -33,6 +33,10 @@ const devSocketIOPlugin = (): Plugin => ({
         console.log('Client disconnected');
       });
     });
+
+    // setup y-socket.io
+    const ysocketio = new YSocketIO(io);
+    ysocketio.initialize();
   },
 });