diff --git a/lazer/sdk/js/examples/index.ts b/lazer/sdk/js/examples/index.ts index d17a212dff..670ab323e8 100644 --- a/lazer/sdk/js/examples/index.ts +++ b/lazer/sdk/js/examples/index.ts @@ -38,4 +38,14 @@ client.ws.addEventListener("open", () => { channel: "fixed_rate@200ms", jsonBinaryEncoding: "hex", }); + + // Example: Update an existing subscription + setTimeout(() => { + client.send({ + type: "updateSubscription", + subscriptionId: 1, + priceFeedIds: [1, 2, 3], + properties: ["price", "bestBidPrice"], + }); + }, 2000); // Wait 2 seconds before updating }); diff --git a/lazer/sdk/js/src/protocol.ts b/lazer/sdk/js/src/protocol.ts index 52c2918d56..366ad488b4 100644 --- a/lazer/sdk/js/src/protocol.ts +++ b/lazer/sdk/js/src/protocol.ts @@ -19,6 +19,12 @@ export type Request = | { type: "unsubscribe"; subscriptionId: number; + } + | { + type: "updateSubscription"; + subscriptionId: number; + priceFeedIds: number[]; + properties: PriceFeedProperty[]; }; export type ParsedFeedPayload = {