Skip to content

Commit bfd7b2f

Browse files
committed
Support for passing headers through to ws connect calls
Signed-off-by: Chris Bygrave <[email protected]>
1 parent 2482207 commit bfd7b2f

File tree

5 files changed

+7
-3
lines changed

5 files changed

+7
-3
lines changed

lib/firefly.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,7 @@ export default class FireFly extends HttpBase {
549549
listen(
550550
subscriptions: string | string[] | FireFlySubscriptionBase,
551551
callback: FireFlyWebSocketCallback,
552+
headers?: Record<string, string>,
552553
): FireFlyWebSocket {
553554
const options: FireFlyWebSocketOptions = {
554555
host: this.options.websocket.host,
@@ -559,6 +560,7 @@ export default class FireFly extends HttpBase {
559560
autoack: false,
560561
reconnectDelay: this.options.websocket.reconnectDelay,
561562
heartbeatInterval: this.options.websocket.heartbeatInterval,
563+
headers: headers,
562564
};
563565

564566
const handler: FireFlyWebSocketCallback = (socket, event) => {

lib/interfaces.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export interface FireFlyWebSocketOptions {
6161
autoack: boolean;
6262
reconnectDelay: number;
6363
heartbeatInterval: number;
64+
headers?: Record<string, string>;
6465
}
6566

6667
// Namespace

lib/websocket.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ export class FireFlyWebSocket {
5959
const socket = (this.socket = new WebSocket(url, {
6060
auth,
6161
handshakeTimeout: this.options.heartbeatInterval,
62+
headers: this.options.headers,
6263
}));
6364
this.closed = false;
6465

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hyperledger/firefly-sdk",
3-
"version": "1.2.3",
3+
"version": "1.2.4",
44
"description": "Client SDK for Hyperledger FireFly",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

0 commit comments

Comments
 (0)