fix(companion): validate runtime and heartbeat loop options
This commit is contained in:
@@ -270,9 +270,13 @@ export class CompanionRuntimeClient {
|
||||
private readonly eventHandlers = new Set<CompanionEventHandler>();
|
||||
|
||||
constructor(options: CompanionRuntimeClientOptions) {
|
||||
const requestTimeoutMs = options.requestTimeoutMs ?? 15_000;
|
||||
if (!Number.isFinite(requestTimeoutMs) || requestTimeoutMs <= 0) {
|
||||
throw new Error('requestTimeoutMs must be a positive number');
|
||||
}
|
||||
this.url = options.url;
|
||||
this.token = options.token;
|
||||
this.requestTimeoutMs = options.requestTimeoutMs ?? 15_000;
|
||||
this.requestTimeoutMs = requestTimeoutMs;
|
||||
this.autoConnect = options.autoConnect ?? false;
|
||||
this.websocketFactory = options.websocketFactory ?? ((url) => new WebSocket(url));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user