# README
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
- SignalR specification: https://docs.microsoft.com/en-us/aspnet/signalr/overview/
- Excellent technical deep dive of the protocol: https://blog.3d-logic.com/2015/03/29/signalr-on-the-wire-an-informal-description-of-the-signalr-protocol/
Contribute
If anything is unclear or could be improved, please open an issue or submit a pull request. Thanks!
# 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