Skip to content

Golang SDK using the WebSocket protocol to communicate with Kuzzle API including offline resiliency

License

Notifications You must be signed in to change notification settings

kuzzleio/sdk-go

Repository files navigation

GitHub branch checks state undefined

About

Kuzzle Go

This is the official Go SDK for the free and open-source backend Kuzzle. It provides a way to dial with a Kuzzle server from Go applications. The SDK provides a native WebSocket support. You can add your own network protocol by implementing the Protocol interface.

📚 Documentation

Kuzzle

Kuzzle is a ready-to-use, on-premises and scalable backend that enables you to manage your persistent data and be notified in real-time on whatever happens to it. It also provides you with a flexible and powerful user-management system.

Get trained by the creators of Kuzzle ⚡

Train yourself and your teams to use Kuzzle to maximize its potential and accelerate the development of your projects.
Our teams will be able to meet your needs in terms of expertise and multi-technology support for IoT, mobile/web, backend/frontend, devops.
👉 Get a quote

Usage

Installation

Simply download the SDK to your GOPATH.

go get github.com/kuzzleio/sdk-go

Example

The SDK supports different protocols. When instantiating, you must choose the protocol to use and fill in the different options needed to connect to Kuzzle.

package main

import (
	"fmt"

	"github.com/kuzzleio/sdk-go/kuzzle"
	"github.com/kuzzleio/sdk-go/protocol/websocket"
)

func main() {
	conn := websocket.NewWebSocket("localhost", nil)
	k, _ := kuzzle.NewKuzzle(conn, nil)
	k.Connect()

	timestamp, err := k.Server.Now(nil)

	if err != nil {
		fmt.Println(err.Error())
		return
	}

	fmt.Println(timestamp)
}

Contributing

First of all, thank you to take the time to contribute to this SDK. To help us validating your future pull request, please make sure your work pass linting and unit tests.

$ bash .ci/test_with_coverage.sh 

If you want to see current coverage run the script with this argument.

$ bash .ci/test_with_coverage.sh  --html

This should open a new tab in your favorite web browser and allow you to see the lines of code covered by the unit tests.