Go

Go SDK

Official Go SDK for Fluxum API

WebSocket-based
End-to-end encryption
Goroutines support
Go 1.21+

Quick Start

Get up and running with the Fluxum Go SDK in minutes

Using go mod

go mod init your-project
go get fluxum/fluxum-sdk-go

Goroutines Support

Built with Go's concurrency patterns and goroutines for high-performance applications.

Security

Built-in client-side encryption with optional custom encryption keys for maximum security.

Analytics

Comprehensive analytics tracking for connections, jobs, and rate limits with Go channels.

Event Handling

Handle real-time events with the SDK

val eventListener = MyEventListener{}
sdk.AddEventListener(eventListener)

Job Submission Examples

Examples of different job types and configurations

Simple GET Request

requestData := map[string]interface{}{
    "url": "https://api.example.com/data",
    "method": "GET",
    "headers": map[string]string{
        "Authorization": "Bearer your-token"
    },
}

jobPayload := models.NewJobPayload(requestData)
jobID, err := sdk.SubmitJob(jobPayload)

Advanced Features

Advanced configuration and features

Custom Encryption

options := config.NewBuilder().
    APIKey("your-api-key").
    EnableClientSideEncryption(true).
    EncryptionKey("your-custom-encryption-key").
    Build()

sdk := fluxum.NewFluxumSDK(options)

Connection Management

// Manual connection
sdk.connect()

// Disconnect
sdk.disconnect()

// Check connection status
if (sdk.isConnected()) {
    fmt.Println("Connected")
}

// Reconnect
sdk.reconnect()

Analytics

// Get analytics data
analytics := sdk.getAnalytics()

fmt.Printf("Total jobs: %d
", analytics.totalJobs)
fmt.Printf("Successful jobs: %d
", analytics.successfulJobs)
fmt.Printf("Failed jobs: %d
", analytics.failedJobs)
fmt.Printf("Average response time: %v
", analytics.averageResponseTime)

// Reset analytics
sdk.resetAnalytics()

Error Handling

Comprehensive error handling and recovery

val robustEventListener = MyEventListener{}
sdk.AddEventListener(robustEventListener)

Requirements

System requirements and dependencies

Go Version

Go 1.21.0 or higher

Dependencies

  • fluxum/fluxum-sdk-go (Go module)
  • gorilla/websocket (WebSocket client)
  • crypto (built-in Go package)
  • context (built-in Go package)

API Reference

Complete API documentation

Constructor

fluxum.NewFluxumSDK(options *config.Options) *FluxumSDK

type Options struct {
    APIKey                    string
    AutoConnect              bool
    EnableAnalytics          bool
    EnableClientSideEncryption bool
    MaxReconnectAttempts     int
    ReconnectDelay           time.Duration
    ConnectionTimeout        time.Duration
    LogLevel                 string
}

Methods

// Connection
fun connect()
fun disconnect()
fun reconnect()

// Status
sdk.isConnected() -> bool
sdk.isAuthenticated() -> bool

// Jobs
fun submitJob(payload: JobPayload) -> str
fun cancelJob(jobId: string) error

// Analytics
fun getAnalytics() *AnalyticsData
fun resetAnalytics()

// Events
fun addEventListener(listener EventListener)
fun removeEventListener(listener EventListener)