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">
</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="viewport">

View File

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

View File

@ -32,7 +32,12 @@ module.exports = function() {
.use(allRequests)
.use(index)
.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("views", path.join(__dirname, "..", "client"));