feat(assist): another approach with io.engine
This commit is contained in:
parent
3e82da1a26
commit
83294b1980
1 changed files with 4 additions and 4 deletions
|
|
@ -94,10 +94,6 @@ const createSocketIOServer = function (server, prefix) {
|
|||
credentials: true
|
||||
},
|
||||
path: (prefix ? prefix : '') + '/socket',
|
||||
allowRequest: (req, callback) => {
|
||||
req.res.setHeader('x-host-id', process.env.HOSTNAME || 'unknown');
|
||||
callback(null, true);
|
||||
},
|
||||
...getCompressionConfig()
|
||||
};
|
||||
|
||||
|
|
@ -108,6 +104,10 @@ const createSocketIOServer = function (server, prefix) {
|
|||
io.attachApp(server);
|
||||
}
|
||||
|
||||
io.engine.on("headers", (headers) => {
|
||||
headers["x-host-id"] = process.env.HOSTNAME || "unknown";
|
||||
});
|
||||
|
||||
if (useRedis) {
|
||||
startCacheRefresher();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue