*** id: 4af32108-1261-4b54-8eaa-c5b9b3b31f73 title: Go SDK slug: /go/reference max-toc-depth: 3 ---------------- [link]: /docs/server-sdk/v2/go/reference/consumer The [RELAY v4](/docs/server-sdk) is the most up-to-date version of the Realtime RELAY SDK. Consider upgrading to take advantage of the latest features and improvements. ## About RELAY Realtime SDK v2 The SignalWire Realtime SDK v2 provides multi-language support for building real-time communication applications with persistent WebSocket connections. ### Capabilities * **Voice (Calling)**: Make and receive calls, control call flow, play audio, record calls, detect answering machines, and implement complex IVR systems * **Messaging**: Send and receive SMS/MMS messages with delivery tracking and media support * **Tasking**: Queue and process background jobs with reliable delivery ### SDK Components The SDK provides three components for connecting to RELAY: * **Consumer**: Long-running process for handling incoming events. Recommended for most use cases. * **Task**: Queue jobs for Consumers from short-lived processes (e.g., web requests). Useful when you can't maintain a persistent connection. * **Client**: Lower-level connection for outbound-only scripts or when you need custom control over the connection. ### Contexts RELAY uses **Contexts** to route events to specific consumers. A context is a named string that categorizes requests, allowing you to: * Write consumers for specific types of calls or messages * Scale different workloads independently * Separate traffic based on business rules For example, configure a support phone number with the `support` context and a personal number with `personal` context. RELAY delivers events only to consumers listening for those contexts. ## Getting Started The RELAY SDK for Go enables Go developers to connect and use SignalWire's RELAY APIs within their own Go code. ## Installation Install the package using "go get". ```shell go get github.com/signalwire/signalwire-golang ``` ## Minimum Requirements The Go SDK requires **`Go 1.11`** or greater installed on your system. ## Using the SDK To use the SDK, you need your **project** and **token** from your SignalWire dashboard. ### RELAY Consumer A [`Relay.Consumer`][link] creates a long running process, allowing you to respond to incoming requests and events in realtime. RELAY Consumers abstract all the setup of connecting to RELAY and automatically dispatches workers to handle requests; so you can concentrate on writing your code without having to worry about multi-threading or blocking, everything just works. Think of RELAY Consumers like a background worker system for all your calling and messaging needs. RELAY Consumers can scale easily, simply by running multiple instances of your `Relay.Consumer` process. Each event will only be delivered to a single consumer, so as your volume increases, just scale up! This process works well whether you are using Docker Swarm, a Procfile on Heroku, your own webserver, and most other environments. > Setting up a new consumer is the easiest way to get up and running. ```go consumer := new(signalwire.Consumer) // setup the Client consumer.Setup(PProjectID, PTokenID, Contexts) // register callback consumer.Ready = MyReady // start if err := consumer.Run(); err != nil { signalwire.Log.Error("Error occurred while starting Signalwire Consumer\n") } ``` [Learn more about RELAY Consumers][link]