fix(core): update

This commit is contained in:
Philipp Kunz 2022-03-24 12:52:28 +01:00
parent be9b47e73b
commit 75bd7a9175
6 changed files with 2808 additions and 3213 deletions

5995
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -25,8 +25,8 @@
"@pushrocks/isounique": "^1.0.5", "@pushrocks/isounique": "^1.0.5",
"@pushrocks/lik": "^5.0.4", "@pushrocks/lik": "^5.0.4",
"@pushrocks/smartdelay": "^2.0.13", "@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16", "@pushrocks/smartenv": "^5.0.0",
"@pushrocks/smartexpress": "^3.0.108", "@pushrocks/smartexpress": "^4.0.0",
"@pushrocks/smartjson": "^4.0.6", "@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartlog": "^2.0.44", "@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpromise": "^3.1.7", "@pushrocks/smartpromise": "^3.1.7",
@ -36,11 +36,11 @@
"socket.io-client": "^4.4.1" "socket.io-client": "^4.4.1"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.50", "@gitzone/tsbuild": "^2.1.60",
"@gitzone/tsrun": "^1.2.31", "@gitzone/tsrun": "^1.2.31",
"@gitzone/tstest": "^1.0.67", "@gitzone/tstest": "^1.0.69",
"@pushrocks/tapbundle": "^5.0.2", "@pushrocks/tapbundle": "^5.0.2",
"@types/node": "^17.0.21", "@types/node": "^17.0.23",
"tslint": "^6.1.3", "tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0" "tslint-config-prettier": "^1.18.0"
}, },

View File

@ -143,9 +143,10 @@ tap.test('should be able to locate a connection tag after reconnect', async (too
}); });
// terminate // terminate
tap.test('should close the server', async () => { tap.test('should close the server', async (tools) => {
await testSmartsocketClient.stop(); await testSmartsocketClient.stop();
await testSmartsocket.stop(); await testSmartsocket.stop();
tools.delayFor(1000).then(() => process.exit(0));
}); });
tap.start(); tap.start();

View File

@ -46,8 +46,8 @@ export class Smartsocket {
* starts smartsocket * starts smartsocket
*/ */
public async start() { public async start() {
const socketIoModule = this.smartenv.getSafeNodeModule('socket.io'); const socketIoModule = await this.smartenv.getSafeNodeModule('socket.io');
this.io = socketIoModule(await this.socketServer.getServerForSocketIo()); this.io = new socketIoModule.Server(await this.socketServer.getServerForSocketIo());
await this.socketServer.start(); await this.socketServer.start();
this.io.on('connection', (socketArg) => { this.io.on('connection', (socketArg) => {
this._handleSocketConnection(socketArg); this._handleSocketConnection(socketArg);

View File

@ -47,7 +47,7 @@ export class SocketServer {
if (this.httpServer) { if (this.httpServer) {
return this.httpServer; return this.httpServer;
} else { } else {
const httpModule = this.smartsocket.smartenv.getSafeNodeModule('http'); const httpModule = await this.smartsocket.smartenv.getSafeNodeModule('http');
this.httpServer = new httpModule.Server(); this.httpServer = new httpModule.Server();
this.standaloneServer = true; this.standaloneServer = true;
return this.httpServer; return this.httpServer;

View File

@ -10,10 +10,13 @@ import type * as smartexpress from '@pushrocks/smartexpress';
export { smartexpress }; export { smartexpress };
// third party scope // third party scope
import type socketIo from 'socket.io'; import type { Socket as ServerSocket, Server as ServerServer} from 'socket.io';
import type { Socket as ClientSocket, connect as ClientIo } from 'socket.io-client'; import type { Socket as ClientSocket, connect as ClientIo } from 'socket.io-client';
export { socketIo }; export namespace socketIo {
export type Socket = ServerSocket;
export type Server = ServerServer;
}
export namespace socketIoClient { export namespace socketIoClient {
export type Socket = ClientSocket; export type Socket = ClientSocket;
export type connect = typeof ClientIo; export type connect = typeof ClientIo;