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