Compare commits

...

5 Commits

Author SHA1 Message Date
6ee70ecafa 2.0.3 2022-03-24 20:26:03 +01:00
6f3700adc0 2.0.2 2022-03-24 20:17:04 +01:00
3648f12358 fix(core): update 2022-03-24 20:17:04 +01:00
c239eaa9d5 2.0.1 2022-03-24 12:52:29 +01:00
75bd7a9175 fix(core): update 2022-03-24 12:52:28 +01:00
6 changed files with 2842 additions and 3245 deletions

6053
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartsocket",
"version": "2.0.0",
"version": "2.0.3",
"description": "easy and secure websocket communication",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -21,12 +21,12 @@
"homepage": "https://gitlab.com/pushrocks/smartsocket#README",
"dependencies": {
"@apiglobal/typedrequest-interfaces": "^1.0.15",
"@pushrocks/isohash": "^1.0.2",
"@pushrocks/isohash": "^2.0.0",
"@pushrocks/isounique": "^1.0.5",
"@pushrocks/lik": "^5.0.4",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^4.0.16",
"@pushrocks/smartexpress": "^3.0.108",
"@pushrocks/smartenv": "^5.0.0",
"@pushrocks/smartexpress": "^4.0.0",
"@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartlog": "^2.0.44",
"@pushrocks/smartpromise": "^3.1.7",
@ -36,11 +36,11 @@
"socket.io-client": "^4.4.1"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.50",
"@gitzone/tsrun": "^1.2.31",
"@gitzone/tstest": "^1.0.67",
"@pushrocks/tapbundle": "^5.0.2",
"@types/node": "^17.0.21",
"@gitzone/tsbuild": "^2.1.61",
"@gitzone/tsrun": "^1.2.32",
"@gitzone/tstest": "^1.0.69",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.23",
"tslint": "^6.1.3",
"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
tap.test('should close the server', async () => {
tap.test('should close the server', async (tools) => {
await testSmartsocketClient.stop();
await testSmartsocket.stop();
tools.delayFor(1000).then(() => process.exit(0));
});
tap.start();

View File

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

View File

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

View File

@ -10,10 +10,13 @@ import type * as smartexpress from '@pushrocks/smartexpress';
export { smartexpress };
// 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';
export { socketIo };
export namespace socketIo {
export type Socket = ServerSocket;
export type Server = ServerServer;
}
export namespace socketIoClient {
export type Socket = ClientSocket;
export type connect = typeof ClientIo;