This commit is contained in:
SamTV12345 2024-03-08 18:24:28 +01:00
parent 052b5057c7
commit dd3091c78a
2 changed files with 5 additions and 5 deletions

View file

@ -21,9 +21,9 @@
* limitations under the License. * limitations under the License.
*/ */
const ueberDB = require('ueberdb2'); import ueberDB from 'ueberdb2';
const settings = require('../utils/Settings'); const settings = require('../utils/Settings');
const log4js = require('log4js'); import log4js from 'log4js';
const stats = require('../stats') const stats = require('../stats')
const logger = log4js.getLogger('ueberDB'); const logger = log4js.getLogger('ueberDB');

View file

@ -17,7 +17,7 @@ const logger = log4js.getLogger('socket.io');
const sockets = new Set(); const sockets = new Set();
const socketsEvents = new events.EventEmitter(); const socketsEvents = new events.EventEmitter();
exports.expressCloseServer = async () => { export const expressCloseServer = async () => {
if (io == null) return; if (io == null) return;
logger.info('Closing socket.io engine...'); logger.info('Closing socket.io engine...');
// Close the socket.io engine to disconnect existing clients and reject new clients. Don't call // Close the socket.io engine to disconnect existing clients and reject new clients. Don't call
@ -48,7 +48,7 @@ exports.expressCloseServer = async () => {
logger.info('All socket.io clients have disconnected'); logger.info('All socket.io clients have disconnected');
}; };
export const socketSessionMiddleware = (args: any) => (socket: any, next: Function) => { const socketSessionMiddleware = (args: any) => (socket: any, next: Function) => {
const req = socket.request; const req = socket.request;
// Express sets req.ip but socket.io does not. Replicate Express's behavior here. // Express sets req.ip but socket.io does not. Replicate Express's behavior here.
if (req.ip == null) { if (req.ip == null) {
@ -65,7 +65,7 @@ export const socketSessionMiddleware = (args: any) => (socket: any, next: Functi
express.sessionMiddleware(req, {}, next); express.sessionMiddleware(req, {}, next);
}; };
exports.expressCreateServer = (hookName:string, args:ArgsExpressType, cb:Function) => { export const expressCreateServer = (hookName:string, args:ArgsExpressType, cb:Function) => {
// init socket.io and redirect all requests to the MessageHandler // init socket.io and redirect all requests to the MessageHandler
// there shouldn't be a browser that isn't compatible to all // there shouldn't be a browser that isn't compatible to all
// transports in this list at once // transports in this list at once