Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
f33b64d625 | |||
6ee70ecafa | |||
6f3700adc0 | |||
3648f12358 | |||
c239eaa9d5 | |||
75bd7a9175 |
6053
package-lock.json
generated
6053
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
18
package.json
18
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/smartsocket",
|
"name": "@pushrocks/smartsocket",
|
||||||
"version": "2.0.0",
|
"version": "2.0.4",
|
||||||
"description": "easy and secure websocket communication",
|
"description": "easy and secure websocket communication",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
@ -21,12 +21,12 @@
|
|||||||
"homepage": "https://gitlab.com/pushrocks/smartsocket#README",
|
"homepage": "https://gitlab.com/pushrocks/smartsocket#README",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
"@apiglobal/typedrequest-interfaces": "^1.0.15",
|
||||||
"@pushrocks/isohash": "^1.0.2",
|
"@pushrocks/isohash": "^2.0.0",
|
||||||
"@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.61",
|
||||||
"@gitzone/tsrun": "^1.2.31",
|
"@gitzone/tsrun": "^1.2.32",
|
||||||
"@gitzone/tstest": "^1.0.67",
|
"@gitzone/tstest": "^1.0.69",
|
||||||
"@pushrocks/tapbundle": "^5.0.2",
|
"@pushrocks/tapbundle": "^5.0.3",
|
||||||
"@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"
|
||||||
},
|
},
|
||||||
|
@ -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();
|
||||||
|
@ -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);
|
||||||
|
@ -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;
|
||||||
|
@ -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;
|
||||||
|
Reference in New Issue
Block a user