Compare commits

..

4 Commits

Author SHA1 Message Date
7677b1bb48 1.1.30 2019-04-24 16:09:01 +02:00
114379c5b3 fix(core): update 2019-04-24 16:09:01 +02:00
79ae7d2039 1.1.29 2019-04-24 15:47:29 +02:00
d2cb6a3045 fix(core): update 2019-04-24 15:47:28 +02:00
4 changed files with 11 additions and 4 deletions

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartsocket",
"version": "1.1.28",
"version": "1.1.30",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartsocket",
"version": "1.1.28",
"version": "1.1.30",
"description": "easy and secure websocket communication",
"main": "dist/index.js",
"typings": "dist/index.d.ts",

View File

@ -13,7 +13,7 @@ import { SocketServer } from './smartsocket.classes.socketserver';
import * as SocketIO from 'socket.io';
export interface ISmartsocketConstructorOptions {
port: number;
port?: number;
}
export class Smartsocket {
@ -29,7 +29,9 @@ export class Smartsocket {
}
// tslint:disable-next-line:member-ordering
public setExternalServer = this.socketServer.setExternalServer;
public async setExternalServer (serverType: 'express' | 'http', serverArg: any) {
await this.socketServer.setExternalServer(serverType, serverArg);
}
/**
* starts smartsocket

View File

@ -55,7 +55,12 @@ export class SocketServer {
const done = plugins.smartpromise.defer();
// handle http servers
// 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')
}
this.httpServer.listen(this.smartsocket.options.port, () => {
console.log(`Server started in standalone mode on ${this.smartsocket.options.port}`);
done.resolve();