Browse Source

refactor createIoServer

develop
Rob Colbert 11 months ago
parent
commit
c873eb16e9
  1. 24
      dtp-base.js

24
dtp-base.js

@ -171,9 +171,7 @@ class SiteWebApp extends SiteRuntime {
this.app.use(
(req, res, next) => {
res.locals.dtp = {
request: req,
};
res.locals.dtp = { request: req };
return next();
},
sessionService.middleware(),
@ -200,15 +198,7 @@ class SiteWebApp extends SiteRuntime {
*/
this.httpServer = http.createServer(this.app);
/*
* Create Socket.io server bound to HTTP server
*/
const { SiteIoServer } = await import('./lib/site-ioserver.js');
this.log.info('creating Socket.io server');
this.io = new SiteIoServer(this);
await this.io.start(this.httpServer);
this.createIoServer();
/*
* Start the HTTP server
@ -230,6 +220,16 @@ class SiteWebApp extends SiteRuntime {
});
}
async createIoServer ( ) {
/*
* Create Socket.io server bound to HTTP server
*/
const { SiteIoServer } = await import('./lib/site-ioserver.js');
this.log.info('creating Socket.io server');
this.io = new SiteIoServer(this);
await this.io.start(this.httpServer);
}
async loadControllers ( ) {
const basePath = path.join(this.config.root, 'app', 'controllers');
const entries = await fs.promises.readdir(basePath, { withFileTypes: true });

Loading…
Cancel
Save