thelounge/client/js/socket.js
2019-11-25 20:13:14 +02:00

17 lines
405 B
JavaScript

"use strict";
import io from "socket.io-client";
const socket = io({
transports: JSON.parse(document.body.dataset.transports),
path: window.location.pathname + "socket.io/",
autoConnect: false,
reconnection: !document.body.classList.contains("public"),
});
// Ease debugging socket during development
if (process.env.NODE_ENV === "development") {
window.socket = socket;
}
export default socket;