SDK Installation


Requirements

Before installing the Togo MQ SDK, ensure you have:

  • Go 1.24 or higher installed on your system
  • Access to a TogoMQ account - Sign up here if you don't have one
  • Valid TogoMQ authentication token - Generate one in your dashboard

Go SDK Installation

The official Togo MQ SDK for Go is available via go get:

go get github.com/TogoMQ/togomq-sdk-go

This will download the latest version of the SDK and all its dependencies.

Install a Specific Version

To install a specific version of the SDK:

go get github.com/TogoMQ/togomq-sdk-go@v0.2.3

Update to Latest Version

To update to the latest version:

go get -u github.com/TogoMQ/togomq-sdk-go

Verifying Installation

Create a simple test file to verify the installation:

test-install.go:

package main

import (
    "fmt"
    "github.com/TogoMQ/togomq-sdk-go"
)

func main() {
    // This will fail without a valid token, but verifies the SDK is installed
    config := togomq.NewConfig(
        togomq.WithToken("test-token"),
    )

    fmt.Println("TogoMQ SDK installed successfully!")
    fmt.Printf("Config created: %+v\n", config)
}

Run the test:

go run test-install.go

If you see output without import errors, the SDK is installed correctly!

Quick Start

Once installed, you can start using the SDK:

package main

import (
    "context"
    "log"
    "os"

    "github.com/TogoMQ/togomq-sdk-go"
)

func main() {
    // Create configuration
    config := togomq.NewConfig(
        togomq.WithToken(os.Getenv("TOGOMQ_TOKEN")),
    )

    // Create client
    client, err := togomq.NewClient(config)
    if err != nil {
        log.Fatalf("Failed to create client: %v", err)
    }
    defer client.Close()

    // Create and publish a message
    msg := togomq.NewMessage("test-topic", []byte("Hello, TogoMQ!"))
    resp, err := client.PubBatch(context.Background(), []*togomq.Message{msg})
    if err != nil {
        log.Fatalf("Failed to publish: %v", err)
    }

    log.Printf("Published %d messages successfully!", resp.MessagesReceived)
}

Before running:

  1. Make sure you have a valid token from your dashboard
  2. Set the token as an environment variable:
    export TOGOMQ_TOKEN="your-token-here"
  3. Run your program:
    go run main.go

Coming Soon

We're actively developing SDKs for additional programming languages:

  • Python - Coming soon
  • PHP - Coming soon
  • JavaScript/Node.js - Coming soon
  • Others - Coming soon

All SDKs will leverage gRPC for high-performance, type-safe communication with the Togo MQ platform.

SDK Features

The Togo MQ SDK includes:

  • 🚀 High Performance - Built on gRPC for efficient communication
  • 📡 Streaming Support - Native support for streaming pub/sub operations
  • 🔒 Secure - TLS encryption and token-based authentication
  • 🎯 Simple API - Easy-to-use client with fluent configuration
  • 📝 Comprehensive Logging - Configurable log levels for debugging
  • Concurrent - Safe for concurrent use with goroutines
  • Well Tested - Comprehensive test coverage

{success} Next: Learn about Publishing Messages to start sending messages with Togo MQ.