Merge pull request #1197 from thelounge/xpaw/socketio-transports

Correctly configure client socket transports
This commit is contained in:
Pavel Djundik 2017-06-08 20:19:49 +03:00 committed by GitHub
commit ca54c40d0f
3 changed files with 8 additions and 2 deletions

View file

@ -25,7 +25,7 @@
<meta name="theme-color" content="#455164"> <meta name="theme-color" content="#455164">
</head> </head>
<body class="signed-out {{#if public}}public{{/if}}"> <body class="signed-out {{#if public}}public{{/if}}" data-transports="{{tojson transports}}">
<div id="wrap"> <div id="wrap">
<div id="viewport"> <div id="viewport">

View file

@ -5,6 +5,7 @@ const io = require("socket.io-client");
const path = window.location.pathname + "socket.io/"; const path = window.location.pathname + "socket.io/";
const socket = io({ const socket = io({
transports: $(document.body).data("transports"),
path: path, path: path,
autoConnect: false, autoConnect: false,
reconnection: false reconnection: false

View file

@ -32,7 +32,12 @@ module.exports = function() {
.use(allRequests) .use(allRequests)
.use(index) .use(index)
.use(express.static("client")) .use(express.static("client"))
.engine("html", expressHandlebars({extname: ".html"})) .engine("html", expressHandlebars({
extname: ".html",
helpers: {
tojson: c => JSON.stringify(c)
}
}))
.set("view engine", "html") .set("view engine", "html")
.set("views", path.join(__dirname, "..", "client")); .set("views", path.join(__dirname, "..", "client"));