Compare commits

...

12 Commits

Author SHA1 Message Date
4fc09af779 2.0.17 2023-03-29 16:07:54 +02:00
f73d973383 fix(core): update 2023-03-29 16:07:54 +02:00
d87a942ab3 2.0.16 2023-03-20 18:51:02 +01:00
60e8657467 fix(core): update 2023-03-20 18:51:02 +01:00
5215be946e 2.0.15 2023-02-07 12:32:48 +01:00
b9c67666fa fix(core): update 2023-02-07 12:32:48 +01:00
4b0fb073e6 2.0.14 2022-12-29 13:28:11 +01:00
fc458b6827 fix(core): update 2022-12-29 13:28:11 +01:00
f27b9f8143 2.0.13 2022-12-29 11:18:16 +01:00
38058aba57 fix(core): update 2022-12-29 11:18:15 +01:00
ba38dae64f 2.0.12 2022-12-28 19:51:09 +01:00
69e862a6cf fix(core): update 2022-12-28 19:51:09 +01:00
5 changed files with 982 additions and 854 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@pushrocks/smartsocket",
"version": "2.0.11",
"version": "2.0.17",
"description": "easy and secure websocket communication",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
@ -24,17 +24,18 @@
"@apiglobal/typedrequest-interfaces": "^2.0.1",
"@pushrocks/isohash": "^2.0.0",
"@pushrocks/isounique": "^1.0.5",
"@pushrocks/lik": "^6.0.0",
"@pushrocks/lik": "^6.0.2",
"@pushrocks/smartdelay": "^2.0.13",
"@pushrocks/smartenv": "^5.0.2",
"@pushrocks/smartexpress": "^4.0.18",
"@pushrocks/smartenv": "^5.0.5",
"@pushrocks/smartexpress": "^4.0.34",
"@pushrocks/smartjson": "^5.0.1",
"@pushrocks/smartlog": "^3.0.1",
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartrx": "^3.0.0",
"@pushrocks/smarttime": "^4.0.0",
"socket.io": "^4.5.1",
"socket.io-client": "^4.5.1"
"@pushrocks/smarttime": "^4.0.1",
"engine.io": "6.3.1",
"socket.io": "4.5.4",
"socket.io-client": "4.5.4"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.63",
@ -42,7 +43,7 @@
"@gitzone/tsrun": "^1.2.37",
"@gitzone/tstest": "^1.0.72",
"@pushrocks/tapbundle": "^5.0.4",
"@types/node": "^18.6.3"
"@types/node": "^18.15.11"
},
"private": false,
"files": [

1799
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@pushrocks/smartsocket',
version: '2.0.11',
version: '2.0.17',
description: 'easy and secure websocket communication'
}

View File

@ -30,6 +30,8 @@ export class Smartsocket {
public socketFunctions = new plugins.lik.ObjectMap<SocketFunction<any>>();
public socketRequests = new plugins.lik.ObjectMap<SocketRequest<any>>();
public eventSubject = plugins.smartrx.rxjs.Subject;
private socketServer = new SocketServer(this);
constructor(optionsArg: ISmartsocketConstructorOptions) {
@ -37,7 +39,6 @@ export class Smartsocket {
this.alias = plugins.isounique.uni(this.options.alias);
}
// tslint:disable-next-line:member-ordering
public async setExternalServer(serverType: 'smartexpress', serverArg: any) {
await this.socketServer.setExternalServer(serverType, serverArg);
}
@ -47,7 +48,13 @@ export class Smartsocket {
*/
public async start() {
const socketIoModule = await this.smartenv.getSafeNodeModule('socket.io');
this.io = new socketIoModule.Server(await this.socketServer.getServerForSocketIo());
this.io = new socketIoModule.Server(await this.socketServer.getServerForSocketIo(), {
cors: {
allowedHeaders: '*',
methods: '*',
origin: '*',
}
});
await this.socketServer.start();
this.io.on('connection', (socketArg) => {
this._handleSocketConnection(socketArg);

View File

@ -96,11 +96,11 @@ export class SmartsocketClient {
webUrlArg: 'https://cdn.jsdelivr.net/npm/socket.io-client@4/dist/socket.io.js',
getFunction: () => {
const socketIoBrowserModule = (globalThis as any).io;
console.log('loaded socket.io for browser');
console.log(socketIoBrowserModule);
// console.log('loaded socket.io for browser');
return socketIoBrowserModule;
},
});
// console.log(socketIoClient);
logger.log('info', 'trying to connect...');
const socketUrl = `${this.serverUrl}:${this.serverPort}`;
this.socketConnection = new SocketConnection({
@ -110,7 +110,8 @@ export class SmartsocketClient {
smartsocketHost: this,
socket: await socketIoClient
.connect(socketUrl, {
multiplex: false,
multiplex: true,
rememberUpgrade: true,
autoConnect: false,
reconnectionAttempts: 0,
rejectUnauthorized: socketUrl.startsWith('https://localhost') ? false : true,