Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve hermes client example #2188

Merged
merged 3 commits into from
Dec 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions apps/hermes/client/js/src/examples/HermesClient.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import yargs from "yargs";
import { hideBin } from "yargs/helpers";

import { HermesClient } from "../HermesClient";
import { HermesClient, PriceUpdate } from "../HermesClient";

function sleep(ms: number) {
return new Promise((resolve) => setTimeout(resolve, ms));
Expand Down Expand Up @@ -79,11 +79,12 @@
benchmarksOnly: true,
});

eventSource.onmessage = (event) => {
eventSource.onmessage = (event: MessageEvent<string>) => {
console.log("Received price update:", event.data);
const _priceUpdate = JSON.parse(event.data) as PriceUpdate;

Check warning on line 84 in apps/hermes/client/js/src/examples/HermesClient.ts

View workflow job for this annotation

GitHub Actions / test

'_priceUpdate' is assigned a value but never used
};

eventSource.onerror = (error) => {
eventSource.onerror = (error: Event) => {
console.error("Error receiving updates:", error);
eventSource.close();
};
Expand Down
Loading