corrections

This commit is contained in:
Kilton937342 2022-07-02 17:48:50 +02:00
parent 14ab240398
commit 276f0c63dd
3 changed files with 7 additions and 4 deletions

View File

@ -1,3 +1,3 @@
NEXT_PUBLIC_HOSTNAME=192.168.1.18
PORT=8000
NEXT_PUBLIC_HOST=http://$NEXT_PUBLIC_HOSTNAME:$PORT
NEXT_PUBLIC_PORT=8000
NEXT_PUBLIC_HOST=http://$NEXT_PUBLIC_HOSTNAME:$NEXT_PUBLIC_PORT

View File

@ -30,6 +30,7 @@ export default function RoomPage({ id_code, user }) {
useEffect(() => {
if (isConnected == false && isBrowser) {
console.log('CONNECTED')
connect("/ws/room/" + id_code);
send({
data: {

View File

@ -16,9 +16,11 @@ export const WebsocketProvider = ({ children }) => {
if (isBrowser) {
var url = url.startsWith('/')? url: '/' + url
console.log(
`ws://${process.env.NEXT_PUBLIC_HOSTNAME}:${process.env.NEXT_PUBLIC_PORT}${url}`
);
ws.current = new ReconnectingWebSocket(
`ws://${process.env.NEXT_PUBLIC_HOST}:${process.env.NEXT_PUBLIC_PORT}${url}`
`ws://${process.env.NEXT_PUBLIC_HOSTNAME}:${process.env.NEXT_PUBLIC_PORT}${url}`
);
ws.current.onopen = () => {