Installation

Note:

This SDK is the server half of your integration. Your users read and write feeds from your app with a client SDK, and anything that needs a connected user or a live WebSocket belongs there: the state layer, device push registration, and client-side error handling. See the client-side overview for what lives there. Token signing stays on this side, because it needs your API secret.

Stream CLI and Agent Skills

Manage Stream from your terminal with the Stream CLI, including scripting and AI-agent workflows. Install the CLI and the default Agent Skills:

curl -fsSL https://getstream.io/cli.sh | bash
getstream skills

Then ask your agent in plain English, for example:

/stream List feed groups in my app.

See the CLI docs and Agent Skills docs for more.

go get github.com/GetStream/getstream-go/v6@v6.0.0

Use the latest available SDK release when starting a new integration.
Check getstream-go releases and replace the version if a newer one is available.

GitHub repository: https://github.com/GetStream/getstream-go. Feel free to submit bug reports and feature requests.

The package is tested against these environments:

  • Go 1.19+
  • Go 1.20+
  • Go 1.21+

To create a client, you'll need your API key and secret. Both of them can be found in your Stream Dashboard.

You can optionally configure request timeouts and the HTTP connection pool. The default request timeout is 30 seconds (30000ms).

package main

import (
    "context"
    "log"
    "time"

    "github.com/GetStream/getstream-go/v6"
)

func main() {
    apiKey := ""
    secret := ""

    client, err := getstream.NewClient(apiKey, secret)
    if err != nil {
        log.Fatal(err)
    }

    // optionally override the per-request timeout (default is 30s)
    client, err = getstream.NewClient(apiKey, secret, getstream.WithRequestTimeout(30*time.Second))
    if err != nil {
        log.Fatal(err)
    }

    // Get the feeds client
    feedsClient := client.Feeds()

    ctx := context.Background()

    // Your feeds operations here...
}

Connection pool and timeouts

The shared defaults and tuning options are documented on Connection pooling; this section covers the Go specifics.

By default the SDK uses an HTTP connection pool with keep-alive enabled. You can tune it with functional options:

Option Default Description
WithRequestTimeout (alias WithTimeout) 30s Per-request timeout. Override per call with context.WithTimeout.
WithMaxConnsPerHost 5 Maximum concurrent connections per host.
WithIdleTimeout 55s How long idle connections stay in the pool.
WithConnectTimeout 10s TCP + TLS handshake timeout.
client, err := getstream.NewClient(
    apiKey, secret,
    getstream.WithMaxConnsPerHost(10),
    getstream.WithIdleTimeout(55*time.Second),
    getstream.WithConnectTimeout(10*time.Second),
    getstream.WithRequestTimeout(30*time.Second),
)

You can also set the request timeout (in seconds) with the STREAM_HTTP_TIMEOUT environment variable.

To take full control of the HTTP stack, provide your own client with WithHTTPClient. When set, the pool options above are not applied:

client, err := getstream.NewClient(apiKey, secret, getstream.WithHTTPClient(myHTTPClient))
Add Chat to my app: getstream.io/SKILL.md

The fastest way to build with Stream. Start a new project or improve an existing one. Full CLI and documentation integration out of the box.


Ask your agent:

/stream Build me a Social App with Feeds and Moderation.
/stream Any livestream calls running?
/stream Feeds Go v3: <Your Question>