fix(core): update

This commit is contained in:
Philipp Kunz 2019-04-24 17:10:51 +02:00
parent 7677b1bb48
commit 126f020bf8
5 changed files with 1043 additions and 84 deletions

1106
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -21,6 +21,7 @@
"dependencies": { "dependencies": {
"@pushrocks/lik": "^3.0.5", "@pushrocks/lik": "^3.0.5",
"@pushrocks/smartdelay": "^2.0.3", "@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartexpress": "^3.0.18",
"@pushrocks/smarthash": "^2.0.4", "@pushrocks/smarthash": "^2.0.4",
"@pushrocks/smartlog": "^2.0.19", "@pushrocks/smartlog": "^2.0.19",
"@pushrocks/smartpromise": "^3.0.2", "@pushrocks/smartpromise": "^3.0.2",

View File

@ -29,7 +29,7 @@ export class Smartsocket {
} }
// tslint:disable-next-line:member-ordering // tslint:disable-next-line:member-ordering
public async setExternalServer (serverType: 'express' | 'http', serverArg: any) { public async setExternalServer (serverType: 'smartexpress', serverArg: any) {
await this.socketServer.setExternalServer(serverType, serverArg); await this.socketServer.setExternalServer(serverType, serverArg);
} }

View File

@ -23,12 +23,9 @@ export class SocketServer {
* starts the server with another server * starts the server with another server
* also works with an express style server * also works with an express style server
*/ */
public async setExternalServer(serverType: 'express' | 'http', serverArg: any) { public async setExternalServer(serverType: 'smartexpress', serverArg: plugins.smartexpress.Server) {
if (serverType === 'http') { await serverArg.startedPromise;
this.httpServer = serverArg; this.httpServer = serverArg.httpServer;
} else if (serverType === 'express') {
this.expressServer = serverArg;
}
} }
/** /**
@ -37,14 +34,10 @@ export class SocketServer {
public getServerForSocketIo() { public getServerForSocketIo() {
if (this.httpServer) { if (this.httpServer) {
return this.httpServer; return this.httpServer;
} else if (this.expressServer) { } else {
return this.expressServer;
} else if (!this.httpServer && !this.expressServer) {
this.httpServer = new http.Server(); this.httpServer = new http.Server();
this.standaloneServer = true; this.standaloneServer = true;
return this.httpServer; return this.httpServer;
} else {
throw new Error('no server specified!');
} }
} }

View File

@ -2,9 +2,10 @@ import * as lik from '@pushrocks/lik';
import * as smartlog from '@pushrocks/smartlog'; import * as smartlog from '@pushrocks/smartlog';
import * as smarthash from '@pushrocks/smarthash'; import * as smarthash from '@pushrocks/smarthash';
import * as smartdelay from '@pushrocks/smartdelay'; import * as smartdelay from '@pushrocks/smartdelay';
import * as smartexpress from '@pushrocks/smartexpress';
import * as smartpromise from '@pushrocks/smartpromise'; import * as smartpromise from '@pushrocks/smartpromise';
import * as shortid from 'shortid'; import * as shortid from 'shortid';
import * as socketIo from 'socket.io'; import * as socketIo from 'socket.io';
import * as socketIoClient from 'socket.io-client'; import * as socketIoClient from 'socket.io-client';
export { lik, smartlog, smarthash, smartdelay, smartpromise, shortid, socketIo, socketIoClient }; export { lik, smartlog, smarthash, smartdelay, smartexpress, smartpromise, shortid, socketIo, socketIoClient };