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({
|
2019-11-05 19:22:10 +00:00
|
|
|
transports: JSON.parse(document.body.dataset.transports),
|
2018-03-05 00:59:16 +00:00
|
|
|
path: window.location.pathname + "socket.io/",
|
2017-04-18 07:31:46 +00:00
|
|
|
autoConnect: false,
|
2019-11-05 19:22:10 +00:00
|
|
|
reconnection: !document.body.classList.contains("public"),
|
2017-04-18 07:31:46 +00:00
|
|
|
});
|
|
|
|
|
2019-11-20 18:09:21 +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;
|