fix(core): update

This commit is contained in:
2019-04-26 17:35:15 +02:00
parent 0d39d6f237
commit 86cf94c5dc
6 changed files with 204 additions and 9 deletions

View File

@@ -23,7 +23,10 @@ export class SocketServer {
* starts the server with another server
* also works with an express style server
*/
public async setExternalServer(serverType: 'smartexpress', serverArg: plugins.smartexpress.Server) {
public async setExternalServer(
serverType: 'smartexpress',
serverArg: plugins.smartexpress.Server
) {
await serverArg.startedPromise;
this.httpServer = serverArg.httpServer;
}
@@ -51,8 +54,8 @@ export class SocketServer {
// in case an external server has been set "this.standaloneServer" should be false
if (this.httpServer && this.standaloneServer) {
if (!this.smartsocket.options.port) {
console.log('there should be a port specifed for smartsocket!')
throw new Error('there should be a port specified for smartsocket')
console.log('there should be a port specifed for smartsocket!');
throw new Error('there should be a port specified for smartsocket');
}
this.httpServer.listen(this.smartsocket.options.port, () => {
console.log(`Server started in standalone mode on ${this.smartsocket.options.port}`);