Categorygithub.com/rainhq/signalr/v2
modulepackage
2.4.0
Repository: https://github.com/rainhq/signalr.git
Documentation: pkg.go.dev

# README

PkgGoDev

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.

Examples

Simple example:

package main

import (
	"log"

	"github.com/rainhq/signalr/v2"
)

func main() {
	ctx := context.Background()

	// Prepare a SignalR client.
	c, err := signalr.Dial(
		ctx,
		"https://fake-server.definitely-not-real/signalr",
		`[{"name":"awesomehub"}]`,
	)
	if err != nil {
		log.Fatal(err)
	}

	var msg signalr.Message
	for {
		if err := c.ReadMessage(ctx, &msg); err != nil {
			log.Fatal(err)
		}

		log.Println(msg)
	}
}

Generic usage:

Cryptocurrency examples:

Proxy examples:

Documentation

Contribute

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

# Packages

No description provided by the author
No description provided by the author

# Functions

Dial connects to Signalr endpoint.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
The maximum number of times to re-attempt a connection.
MaxMessageProcessDuration the maximum amount of time to spend on processing message.
The maximum number of times to re-attempt a negotiation.
The maximum amount of time to spend retrying a reconnect attempt.
No description provided by the author
The maximum number of times to re-attempt a start command.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
The time to wait before retrying, in the event that an error occurs when contacting the SignalR service.

# Structs

No description provided by the author
No description provided by the author
ClientMsg represents a message sent to the Hubs API from the client.
No description provided by the author
Conn represents a SignalR connection.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Message represents a message sent from the server to the persistent websocket connection.
No description provided by the author
No description provided by the author
ServerMsg represents a message sent to the Hubs API from the server.
No description provided by the author
State represents a SignalR connection state.
No description provided by the author

# Interfaces

WebsocketConn is a combination of MessageReader and JSONWriter.
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author