Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
4b0fb073e6 | |||
fc458b6827 | |||
f27b9f8143 | |||
38058aba57 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@pushrocks/smartsocket",
|
||||
"version": "2.0.12",
|
||||
"version": "2.0.14",
|
||||
"description": "easy and secure websocket communication",
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@pushrocks/smartsocket',
|
||||
version: '2.0.12',
|
||||
version: '2.0.14',
|
||||
description: 'easy and secure websocket communication'
|
||||
}
|
||||
|
@ -47,7 +47,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);
|
||||
|
@ -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('loaded socket.io for browser');
|
||||
return socketIoBrowserModule;
|
||||
},
|
||||
});
|
||||
console.log(socketIoClient);
|
||||
// console.log(socketIoClient);
|
||||
logger.log('info', 'trying to connect...');
|
||||
const socketUrl = `${this.serverUrl}:${this.serverPort}`;
|
||||
this.socketConnection = new SocketConnection({
|
||||
|
Reference in New Issue
Block a user