thelounge/client/js/socket.js

18 lines
405 B
JavaScript
Raw Normal View History

2017-04-18 07:31:46 +00:00
"use strict";
2019-11-16 17:24:03 +00:00
import io from "socket.io-client";
2017-04-18 07:31:46 +00:00
const socket = io({
transports: JSON.parse(document.body.dataset.transports),
path: window.location.pathname + "socket.io/",
2017-04-18 07:31:46 +00:00
autoConnect: false,
reconnection: !document.body.classList.contains("public"),
2017-04-18 07:31:46 +00:00
});
// Ease debugging socket during development
if (process.env.NODE_ENV === "development") {
window.socket = socket;
}
2019-11-16 17:24:03 +00:00
export default socket;