'Solana websocket RPC with @solana/web3.js
I'm trying to connect to Solana mainnet using websockets. I can't find out how to connect using web3.js. Maybe someone faced this issue and can help me ?
Thanks
Here's a simple line of code I made:
let con = new web3.Connection('https://api.mainnet-beta.solana.com', { commitment: "confirmed", wsEndpoint: 'ws://api.mainnet-beta.solana.com' });
Solution 1:[1]
Check out this example for subscribing to websockets using web3 on the Solana Cookbook: https://solanacookbook.com/references/local-development.html#subscribing-to-websocket
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jon C |
