@onebun/core 0.1.23 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,7 @@ import type {
14
14
  WebSocketApplicationOptions,
15
15
  } from './ws.types';
16
16
  import type { WsHandlerResponse } from './ws.types';
17
+ import type { OneBunRequest } from '../types';
17
18
  import type { Server, ServerWebSocket } from 'bun';
18
19
 
19
20
  import type { SyncLogger } from '@onebun/logger';
@@ -121,7 +122,7 @@ export class WsHandler {
121
122
  /**
122
123
  * Initialize gateways with server
123
124
  */
124
- initializeGateways(server: Server): void {
125
+ initializeGateways(server: Server<WsClientData>): void {
125
126
  for (const [_, gateway] of this.gateways) {
126
127
  gateway.instance._initialize(this.storage, server);
127
128
  }
@@ -182,8 +183,8 @@ export class WsHandler {
182
183
  * Handle WebSocket upgrade request
183
184
  */
184
185
  async handleUpgrade(
185
- req: Request,
186
- server: Server,
186
+ req: OneBunRequest | Request,
187
+ server: Server<WsClientData>,
187
188
  ): Promise<Response | undefined> {
188
189
  const url = new URL(req.url);
189
190
  const path = url.pathname;
@@ -294,7 +294,7 @@ export interface WsGuard {
294
294
  */
295
295
  export interface WsServer {
296
296
  /** Bun server instance */
297
- server: Server;
297
+ server: Server<WsClientData>;
298
298
  /** Publish message to a topic */
299
299
  publish(topic: string, message: string | Buffer): void;
300
300
  /** Get subscriber count for a topic */