Initial commit
This commit is contained in:
14
client/src/socket.js
Normal file
14
client/src/socket.js
Normal file
@@ -0,0 +1,14 @@
|
||||
import { io } from 'socket.io-client';
|
||||
|
||||
const SERVER_URL = window.location.hostname === 'localhost'
|
||||
? 'http://localhost:3001'
|
||||
: `http://${window.location.hostname}:3001`;
|
||||
|
||||
const socket = io(SERVER_URL, {
|
||||
autoConnect: false,
|
||||
reconnection: true,
|
||||
reconnectionAttempts: 10,
|
||||
reconnectionDelay: 1000,
|
||||
});
|
||||
|
||||
export default socket;
|
||||
Reference in New Issue
Block a user