SolanaStreaming Docs

SolanaStreaming Go SDK

Subscribe to live SolanaStreaming websocket data from Go applications.

The Go client provides functions for subscribing to swap events and new trading pairs.

View the Go SDK on GitHub · Go package documentation

Install

Add the client library to your Go module:

go get github.com/solanastreaming/solanastreaming-client-go

Connect and subscribe

Create a client with your SolanaStreaming API key, connect it, then subscribe to the data you need. This example shows the basic flow; see the repository README for additional subscriptions and the latest API details.

package main

import (
    "context"
    "fmt"
    "log"

    solanastreaming "github.com/solanastreaming/solanastreaming-client-go"
)

func main() {
    ctx := context.Background()
    cli := solanastreaming.New("YOUR_API_KEY")
    if err := cli.Connect(ctx); err != nil {
        log.Fatal(err)
    }

    pairs, err := cli.SubscribeNewPairs(ctx, &solanastreaming.NewPairSubscribeParams{
        IncludeLaunchpadTokens: true,
    })
    if err != nil {
        log.Fatal(err)
    }

    for {
        event, err := pairs.Receive(ctx)
        if err != nil {
            log.Fatal(err)
        }
        fmt.Printf("%#v\n", event)
    }
}

Review the websocket API documentation for connection, subscription, and event details.