SignalR WebSocket client written in Golang
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.vscode
examples add note about separate bittrex library May 17, 2018
hubs
vendor
.codeclimate.yml
.gitignore
.pre-commit-config.yaml
.travis.yml switch to travis Aug 26, 2018
Gopkg.lock update dependencies Aug 26, 2018
Gopkg.toml
LICENSE
Makefile
README.md
doc.go
signalr.go fix issue #10 Jun 16, 2018
signalr_internal_test.go
signalr_test.go
testing.go make a public testing api Feb 20, 2018
testing_test.go

README.md

GoDoc Build Status Go Report Card Maintainability codecov

Overview

This is my personal attempt at implementating the client side of the WebSocket portion of the SignalR protocol. I use it for various virtual currency trading platforms that use SignalR.

It supports CloudFlare-protected sites by default.

Examples

Simple example:

package main

import (
	"log"

	"github.com/carterjones/signalr"
)

func main() {
	// Prepare a SignalR client.
	c := signalr.New(
		"fake-server.definitely-not-real",
		"1.5",
		"/signalr",
		`[{"name":"awesomehub"}]`,
		nil,
	)

	// Define message and error handlers.
	msgHandler := func(msg signalr.Message) { log.Println(msg) }
	panicIfErr := func(err error) {
		if err != nil {
			log.Panic(err)
		}
	}

	// Start the connection.
	err := c.Run(msgHandler, panicIfErr)
	panicIfErr(err)

	// Wait indefinitely.
	select {}
}

Generic usage:

Cryptocurrency examples:

Documentation

Contribute

If anything is unclear or could be improved, please open an issue or submit a pull request. Thanks!