You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pyth Lazer is a high-performance, low-latency price feed service that provides real-time financial market data to blockchain applications. This guide will walk you through setting up and running a basic JavaScript example to subscribe to Lazer price feeds.
6
-
7
-
## What You'll Learn
8
-
9
-
In this guide, you'll learn how to:
10
-
11
-
- Set up the Pyth Lazer JavaScript SDK
12
-
- Connect to the Lazer WebSocket stream
13
-
- Subscribe to real-time price feeds
14
-
- Handle both JSON and binary message formats
5
+
Pyth Lazer is a high-performance, low-latency service that provides real-time financial market data.
6
+
This guide will walk you through setting up and running a basic JavaScript example to subscribe to Lazer price feeds.
15
7
16
8
## Prerequisites
17
9
@@ -41,11 +33,7 @@ Install the required dependencies using pnpm:
41
33
pnpm install
42
34
```
43
35
44
-
This will install the following key packages:
45
-
46
-
-`@pythnetwork/pyth-lazer-sdk` - The main Lazer SDK
47
-
-`@solana/web3.js` - For Solana blockchain interactions
48
-
- Other supporting dependencies
36
+
This will install `@pythnetwork/pyth-lazer-sdk`, which is the main Lazer SDK.
49
37
50
38
### Configure Your Access Token
51
39
@@ -69,13 +57,44 @@ Now you can run the basic example that demonstrates connecting to Lazer and rece
69
57
pnpm run start
70
58
```
71
59
72
-
This will execute the main example script that:
60
+
This command will subscribe to Pyth Lazer updates for two price feeds, receiving streaming updates.
61
+
Each update is then printed to the terminal on receipt.
62
+
You should see output similar to the following:
73
63
74
-
- Connects to the Pyth Lazer WebSocket server
75
-
- Subscribes to price feeds (IDs 1 and 2)
76
-
- Listens for both JSON and binary messages
77
-
- Displays received price data and connection status
0 commit comments