Skip to content

Commit

Permalink
fix: socket listen sequelize (#1175)
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 authored Jul 24, 2021
1 parent 246a244 commit 84f9b68
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions packages/socketio/src/framework.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,25 +51,23 @@ export class MidwaySocketIOFramework extends BaseFramework<
this.logger.debug('init socket.io-redis ready!');
}

if (this.applicationContext.registry.hasObject(HTTP_SERVER_KEY)) {
// listen port when http server not exist
if (this.configurationOptions.port) {
this.app.listen(
this.configurationOptions.port,
this.configurationOptions
);
this.logger.info(
`Socket.io server port = ${this.configurationOptions.port} start success`
);
} else if (this.applicationContext.registry.hasObject(HTTP_SERVER_KEY)) {
this.app.attach(
this.applicationContext.get(HTTP_SERVER_KEY),
this.configurationOptions
);
this.logger.info(
'Socket.io server start success and attach to web server'
);
} else {
// listen port when http server not exist
if (this.configurationOptions.port) {
this.app.listen(
this.configurationOptions.port,
this.configurationOptions
);
this.logger.info(
`Socket.io server port = ${this.configurationOptions.port} start success`
);
}
}
}

Expand Down

0 comments on commit 84f9b68

Please sign in to comment.