Skip to content

Commit

Permalink
fix #408
Browse files Browse the repository at this point in the history
  • Loading branch information
mStirner committed Jan 12, 2024
1 parent 696134c commit c085e5d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions routes/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const { ServerResponse } = require("http");
const express = require("express");
const bodyParser = require("body-parser");

Expand Down Expand Up @@ -220,4 +221,20 @@ module.exports = (server) => {
// use express request handler
server.on("request", app);

// fix #408, see:
// https://github.com/OpenHausIO/connector/issues/38
// https://github.com/websockets/ws/issues/2193
server.on("upgrade", (req, socket) => {

let res = new ServerResponse(req);
res.assignSocket(socket);

res.on("finish", () => {
res.socket.destroy();
});

app(req, res);

});

};

0 comments on commit c085e5d

Please sign in to comment.