socket url
This commit is contained in:
parent
1b16c6062a
commit
23b622ca8d
@ -1,7 +1,11 @@
|
|||||||
const toast = require('izitoast');
|
const toast = require('izitoast');
|
||||||
const cbor = require('borc');
|
const cbor = require('borc');
|
||||||
|
|
||||||
const SOCKET_URL = process.env.NODE_ENV === 'production' ? 'wss://mnml.gg/api/ws' : 'ws://localhost/api/ws';
|
const socketUrl = () => {
|
||||||
|
if (process.env.NODE_ENV === 'production') return 'wss://mnml.gg/api/ws';
|
||||||
|
if (process.env.NODE_ENV === 'staging') return 'wss://sixtysix.pro/api/ws';
|
||||||
|
return 'ws://localhost/api/ws';
|
||||||
|
};
|
||||||
|
|
||||||
function errorToast(err) {
|
function errorToast(err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
@ -271,7 +275,7 @@ function createSocket(events) {
|
|||||||
ws = null;
|
ws = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ws = new WebSocket(SOCKET_URL);
|
ws = new WebSocket(socketUrl());
|
||||||
ws.binaryType = 'arraybuffer';
|
ws.binaryType = 'arraybuffer';
|
||||||
|
|
||||||
// Listen for messages
|
// Listen for messages
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user