Skip to content

Commit 65b2f8a

Browse files
committed
Abstract socket logic
1 parent 91e6c48 commit 65b2f8a

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

client/package-lock.json

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/src/App.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
/* eslint-disable react-hooks/exhaustive-deps */
22
import { useEffect, useRef, useState } from "react";
33
import "./App.css";
4-
import { io } from "socket.io-client";
54
import * as Y from "yjs";
65
import { SocketIOProvider } from "y-socket.io";
7-
8-
const socket = io("http://localhost:8000");
6+
import socket from "./Socket";
97

108
import Sidebar from "./components/Sidebar";
119
import Canvas from "./components/Canvas";

client/src/Socket.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { io } from "socket.io-client";
2+
3+
const PORT = "http://localhost:8000";
4+
5+
const socket = io(PORT);
6+
7+
export default socket;

0 commit comments

Comments
 (0)