From 23b622ca8d6f94dc40f961c848b296e5dc192778 Mon Sep 17 00:00:00 2001 From: ntr Date: Mon, 19 Aug 2019 16:40:23 +1000 Subject: [PATCH] socket url --- client/src/socket.jsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/src/socket.jsx b/client/src/socket.jsx index 78ebd771..83c0b088 100644 --- a/client/src/socket.jsx +++ b/client/src/socket.jsx @@ -1,7 +1,11 @@ const toast = require('izitoast'); 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) { console.error(err); @@ -271,7 +275,7 @@ function createSocket(events) { ws = null; } - ws = new WebSocket(SOCKET_URL); + ws = new WebSocket(socketUrl()); ws.binaryType = 'arraybuffer'; // Listen for messages