test
This commit is contained in:
commit
2e45cd6006
@ -1,3 +1,9 @@
|
||||
<<<<<<< HEAD
|
||||
NEXT_PUBLIC_HOSTNAME=141.136.42.178
|
||||
PORT=80
|
||||
NEXT_PUBLIC_HOST=http://$NEXT_PUBLIC_HOSTNAME:$PORT
|
||||
=======
|
||||
NEXT_PUBLIC_HOSTNAME=192.168.1.18
|
||||
NEXT_PUBLIC_PORT=80
|
||||
NEXT_PUBLIC_HOST=http://$NEXT_PUBLIC_HOSTNAME:$NEXT_PUBLIC_PORT
|
||||
>>>>>>> 14ab2403983411dea6475cad781ddef9a1c89b7c
|
||||
|
@ -37,7 +37,7 @@ export default function Join() {
|
||||
isBrowser && isEmpty(authData) && sessionStorage.getItem("clientId")
|
||||
)
|
||||
.then((res) => {
|
||||
connect(`ws://192.168.1.18:8000/ws/room/${res.id_code}`);
|
||||
connect(`/ws/room/${res.id_code}`);
|
||||
if (res.is_auth) {
|
||||
router.push({ pathname: "/room/" + res.id_code }, undefined, {
|
||||
shallow: true,
|
||||
@ -109,7 +109,7 @@ export default function Join() {
|
||||
checkRoom(infos.pin, (isBrowser && isEmpty(authData)) && sessionStorage.getItem('clientId'))
|
||||
.then((res) => {
|
||||
setErrorRoom({ message: "" });
|
||||
connect(`ws://192.168.1.18:8000/ws/room/${res.id_code}`);
|
||||
connect(`/ws/room/${res.id_code}`);
|
||||
if (res.is_auth) {
|
||||
router.push(
|
||||
{ pathname: "/room/" + res.id_code },
|
||||
|
@ -30,7 +30,7 @@ export default function RoomPage({ id_code, user }) {
|
||||
|
||||
useEffect(() => {
|
||||
if (isConnected == false && isBrowser) {
|
||||
connect("ws://192.168.1.18:8000/ws/room/" + id_code);
|
||||
connect("/ws/room/" + id_code);
|
||||
send({
|
||||
data: {
|
||||
type: "reconnect",
|
||||
|
@ -315,7 +315,7 @@ export default function RoomView({ user, id_code }) {
|
||||
onClick={() => {
|
||||
setDataRoom();
|
||||
if (!isConnected) {
|
||||
connect("ws://192.168.1.18:8000/ws/room/" + id_code);
|
||||
connect("/ws/room/" + id_code);
|
||||
}
|
||||
}}
|
||||
className={styles.refresh}
|
||||
|
@ -25,7 +25,7 @@ export default function WaitingRoom() {
|
||||
checkRoom(router.query.mode[1])
|
||||
.then(() => {
|
||||
console.log('CONNECT HERE TO')
|
||||
connect(`ws://192.168.1.18:8000/ws/room/${router.query.mode[1]}`);
|
||||
connect(`ws/room/${router.query.mode[1]}`);
|
||||
send({
|
||||
data: {
|
||||
type: "login",
|
||||
|
@ -14,7 +14,13 @@ export const WebsocketProvider = ({ children }) => {
|
||||
const router = useRouter();
|
||||
const connect = (url) => {
|
||||
if (isBrowser) {
|
||||
ws.current = new ReconnectingWebSocket(url);
|
||||
|
||||
var url = url.startsWith('/')? url: '/' + url
|
||||
|
||||
ws.current = new ReconnectingWebSocket(
|
||||
`ws://${process.env.NEXT_PUBLIC_HOST}:${process.env.NEXT_PUBLIC_PORT}${url}`
|
||||
);
|
||||
|
||||
ws.current.onopen = () => {
|
||||
setConnected(true);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user