@helenejs/server
Advanced tools
Comparing version 1.3.0-alpha.18 to 1.3.0-alpha.19
/// <reference types="node" /> | ||
/// <reference types="express" /> | ||
import WebSocket from 'ws'; | ||
import { RedisClientOptions } from 'redis'; | ||
@@ -11,2 +10,3 @@ import { HttpTransport, RedisTransport, WebSocketTransport } from './transports'; | ||
import { Event } from './event'; | ||
import io from 'socket.io'; | ||
declare global { | ||
@@ -27,3 +27,3 @@ var Helene: Server; | ||
debug?: boolean; | ||
ws?: WebSocket.ServerOptions; | ||
ws?: Partial<io.ServerOptions>; | ||
redis?: RedisClientOptions | boolean; | ||
@@ -30,0 +30,0 @@ requestListener?: RequestListener; |
@@ -72,3 +72,6 @@ "use strict"; | ||
this.webSocketTransport = new transports_1.WebSocketTransport(this, { | ||
host: this.host, | ||
cors: { | ||
origin: origins, | ||
...ws?.cors, | ||
}, | ||
...ws, | ||
@@ -75,0 +78,0 @@ }); |
@@ -1,2 +0,1 @@ | ||
import WebSocket from 'ws'; | ||
import { Server } from '../server'; | ||
@@ -12,4 +11,4 @@ import { Presentation } from '@helenejs/utils'; | ||
wss: io.Server; | ||
options: WebSocket.ServerOptions; | ||
constructor(server: Server, opts: WebSocket.ServerOptions); | ||
options: Partial<io.ServerOptions>; | ||
constructor(server: Server, opts: Partial<io.ServerOptions>); | ||
handleConnection: (socket: io.Socket) => void; | ||
@@ -16,0 +15,0 @@ handleClose: (node: ClientNode) => () => void; |
@@ -17,3 +17,2 @@ "use strict"; | ||
this.options = { | ||
noServer: true, | ||
path: utils_1.HELENE_WS_PATH, | ||
@@ -58,3 +57,3 @@ }; | ||
this.wss = new socket_io_1.default.Server(this.server.httpTransport.http, { | ||
path: this.options.path, | ||
...this.options, | ||
}); | ||
@@ -61,0 +60,0 @@ this.wss.on(utils_1.WebSocketEvents.CONNECTION, this.handleConnection); |
{ | ||
"name": "@helenejs/server", | ||
"version": "1.3.0-alpha.18", | ||
"version": "1.3.0-alpha.19", | ||
"description": "Real-time Web Apps for Node.js and Bun", | ||
@@ -64,3 +64,3 @@ "main": "lib/index.js", | ||
}, | ||
"gitHead": "e51c1a268fc9c3d68aa16622ea73bb5062c9dc83" | ||
"gitHead": "1322dfdc7cbe31e1a48b5f867cd6e0b993388d20" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
102042
1565