Skip to content

Commit bc8a6a9

Browse files
committed
fix: use more specific type for wsOptions
1 parent 24edc8d commit bc8a6a9

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lazer/sdk/js/src/socket/websocket-pool.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { dummyLogger } from "ts-log";
77
import type { Request, Response } from "../protocol.js";
88
import type { ResilientWebSocketConfig } from "./resilient-websocket.js";
99
import { ResilientWebSocket } from "./resilient-websocket.js";
10+
import type { ClientRequestArgs } from "node:http";
1011

1112
/**
1213
* Detects if the code is running in a regular DOM or Web Worker context.
@@ -49,7 +50,7 @@ function isBrowser(): boolean {
4950
function addAuthentication(
5051
url: string,
5152
token: string,
52-
wsOptions: any = {}
53+
wsOptions: WebSocket.ClientOptions | ClientRequestArgs | undefined = {}
5354
): { endpoint: string; wsOptions: any } {
5455
if (isBrowser()) {
5556
// Browser: Add token as query parameter
@@ -58,7 +59,7 @@ function addAuthentication(
5859

5960
// For browsers, we need to filter out any options that aren't valid for WebSocket constructor
6061
// Browser WebSocket constructor only accepts protocols as second parameter
61-
const browserWsOptions = wsOptions.protocols ? wsOptions.protocols : undefined;
62+
const browserWsOptions = wsOptions.protocol ? wsOptions.protocol : undefined;
6263

6364
return {
6465
endpoint: urlObj.toString(),

0 commit comments

Comments
 (0)