electron app - auto find port

This commit is contained in:
Jan Prochazka
2020-04-10 21:21:57 +02:00
parent ac97344c1e
commit 5030c673e6
12 changed files with 88 additions and 56 deletions

View File

@@ -1,5 +1,6 @@
import io from 'socket.io-client';
import React from 'react';
import resolveApi from './resolveApi';
const SocketContext = React.createContext(null);
@@ -7,7 +8,7 @@ export function SocketProvider({ children }) {
const [socket, setSocket] = React.useState();
React.useEffect(() => {
// const newSocket = io('http://localhost:3000', { transports: ['websocket'] });
const newSocket = io('http://localhost:3000');
const newSocket = io(resolveApi());
setSocket(newSocket);
}, []);
return <SocketContext.Provider value={socket}>{children}</SocketContext.Provider>;