File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { Stream , Readable } from 'stream' ;
2
+ import * as http from 'http' ;
2
3
import * as FormData from 'form-data' ;
4
+ import * as WebSocket from 'ws' ;
3
5
import {
4
6
FireFlyStatusResponse ,
5
7
FireFlyPrivateSendOptions ,
@@ -549,7 +551,7 @@ export default class FireFly extends HttpBase {
549
551
listen (
550
552
subscriptions : string | string [ ] | FireFlySubscriptionBase ,
551
553
callback : FireFlyWebSocketCallback ,
552
- headers ?: Record < string , string > ,
554
+ socketOptions ?: WebSocket . ClientOptions | http . ClientRequestArgs ,
553
555
) : FireFlyWebSocket {
554
556
const options : FireFlyWebSocketOptions = {
555
557
host : this . options . websocket . host ,
@@ -560,7 +562,7 @@ export default class FireFly extends HttpBase {
560
562
autoack : false ,
561
563
reconnectDelay : this . options . websocket . reconnectDelay ,
562
564
heartbeatInterval : this . options . websocket . heartbeatInterval ,
563
- headers : headers ,
565
+ socketOptions : socketOptions ,
564
566
} ;
565
567
566
568
const handler : FireFlyWebSocketCallback = ( socket , event ) => {
Original file line number Diff line number Diff line change
1
+ import * as http from 'http' ;
1
2
import { AxiosRequestConfig } from 'axios' ;
3
+ import * as WebSocket from 'ws' ;
2
4
import { operations } from './schema' ;
3
5
4
6
/**
@@ -61,7 +63,7 @@ export interface FireFlyWebSocketOptions {
61
63
autoack : boolean ;
62
64
reconnectDelay : number ;
63
65
heartbeatInterval : number ;
64
- headers ?: Record < string , string > ;
66
+ socketOptions ?: WebSocket . ClientOptions | http . ClientRequestArgs ;
65
67
}
66
68
67
69
// Namespace
Original file line number Diff line number Diff line change @@ -57,9 +57,9 @@ export class FireFlyWebSocket {
57
57
? `${ this . options . username } :${ this . options . password } `
58
58
: undefined ;
59
59
const socket = ( this . socket = new WebSocket ( url , {
60
+ ...this . options . socketOptions ,
60
61
auth,
61
62
handshakeTimeout : this . options . heartbeatInterval ,
62
- headers : this . options . headers ,
63
63
} ) ) ;
64
64
this . closed = false ;
65
65
You can’t perform that action at this time.
0 commit comments