강동현
Builds for 1 pipeline passed in 8 minutes 11 seconds

현재 페이지의 호스트를 사용하여 소켓 접속

1 -import React from 'react'; 1 +import React from "react";
2 -import { io } from 'socket.io-client'; 2 +import { io } from "socket.io-client";
3 3
4 -export const socket = io('http://localhost:3000/'); 4 +export const socket = io(`http://${window.location.hostname}:3000/`);
5 const SocketContext = React.createContext(socket); 5 const SocketContext = React.createContext(socket);
6 6
7 export const SocketProvider = SocketContext.Provider; 7 export const SocketProvider = SocketContext.Provider;
......