helius-labs / websocket-widget

This is a landing page to test Helius Geyser Enhanced Websockets

Home Page:https://websocket-widget.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Websocket Widgets

The Websocket Widget repository is a frontend playground for Helius Geyser Enhanced Websockets.

Documentation

Hosted frontend link coming soon.

Explore the Helius Geyser Enhanced Websockets through the Helius Websockets Documentation.

Prerequisites

To run the frontend locally, ensure these requirements are met:

  • Node.js 14.x or higher
  • npm or yarn
  • A Helius API Key

Installation

Clone the repository and install the dependencies:

git clone https://github.com/HeliusLabs/websocket-widgets.git
cd websocket-widgets/app
npm install

Websocket Example

Here’s a simple example of how you can open the transactionSubscribe Helius Geyser Enhanced Websocket using Javascript:

    const request = {
        jsonrpc: "2.0",
        id: 420,
        method: "transactionSubscribe",
        params: [
            {
                accountInclude: accountsIncluded,
                accountRequire: accountsRequired
            },
            {
                commitment: commitmentState,
                encoding: encoding,
                transactionDetails: details,
                showRewards: true,
                maxSupportedTransactionVersion: 1
            }
        ]
    };

    const wsUrl = `wss://atlas-mainnet.helius-rpc.com?api-key=${apiKey}`;
    ws.current = new WebSocket(wsUrl);
    ws.current.onopen = () => {
        console.log('WebSocket is open');
        ws.current.send(JSON.stringify(request));
    };

Contributing

Contributions are welcome! For major changes, please open an issue first to discuss what you would like to change.

About

This is a landing page to test Helius Geyser Enhanced Websockets

https://websocket-widget.vercel.app


Languages

Language:JavaScript 94.8%Language:CSS 5.2%