From 16fb118d0268c7f891f99b14e5b40bc94901e730 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Thu, 1 Jun 2017 22:43:23 +0300 Subject: [PATCH] Correctly configure client transports Fixes #848 --- client/index.html | 2 +- client/js/socket.js | 1 + src/server.js | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/client/index.html b/client/index.html index 5c11b2f6..8d1cbcc1 100644 --- a/client/index.html +++ b/client/index.html @@ -25,7 +25,7 @@ - +
diff --git a/client/js/socket.js b/client/js/socket.js index 278802d7..6f702fb1 100644 --- a/client/js/socket.js +++ b/client/js/socket.js @@ -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 diff --git a/src/server.js b/src/server.js index db92efe7..73e9b8ea 100644 --- a/src/server.js +++ b/src/server.js @@ -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"));