Documentation ¶
Index ¶
- Constants
- Variables
- func SplitJSON(data []byte, atEOF bool) (advance int, token []byte, err error)
- type AvailableTransport
- type CancelInvocation
- type CloseMessage
- type Completion
- type Encoding
- type Error
- type HandshakeRequest
- type Hub
- type Invocation
- type JSONEncoding
- type JSONReader
- type Message
- type MessageType
- type NegotiateResponse
- type PingMessage
- type RedirectResponse
- type SignalR
- func (s *SignalR) Close() error
- func (s *SignalR) Connect(ctx context.Context, version Version) error
- func (s *SignalR) IsConnected() bool
- func (s *SignalR) Messages() <-chan interface{}
- func (s *SignalR) Send(msg interface{}) error
- func (s *SignalR) SetLogger(log zerolog.Logger)
- func (s *SignalR) SetOnReconnect(onReconnect func() error)
- type StreamInvocation
- type StreamItem
- type Transport
- type Type
- type Version
Constants ¶
View Source
const (
JSONSeparator = 0x1e
)
Separator
Variables ¶
View Source
var ( ErrUnknownMessageType = errors.New("unknown message type") ErrMessageParsing = errors.New("can't parse message") ErrEmptyResponse = errors.New("empty response from server") ErrHandshake = errors.New("handshake error") ErrInvalidStatusCode = errors.New("invalid status code") ErrNegotiate = errors.New("negotiate error") ErrInvalidScheme = errors.New("invalid URL scheme. Expected https or http. Got") ErrConnectionClose = errors.New("connection is closed") ErrTimeout = errors.New("connection timeout") )
Functions ¶
Types ¶
type AvailableTransport ¶
type AvailableTransport struct { Transport string `json:"transport"` TransferFormats []string `json:"transferFormats"` }
AvailableTransport -
type CancelInvocation ¶
type CancelInvocation Message
CancelInvocation - a `CancelInvocation` message
type CloseMessage ¶
type CloseMessage struct { Type Error string `json:"string,omitempty"` AllowReconnect bool `json:"allowReconnect,omitempty"` }
CloseMessage - a `CloseMessage` message
type Completion ¶
type Completion struct { Message Result uint64 `json:"result,omitempty"` Error string `json:"string,omitempty"` }
Completion - a `Completion` message
type Encoding ¶
type Encoding interface { Decode(data []byte) (interface{}, error) Encode(msg interface{}) ([]byte, error) }
Encoding -
type HandshakeRequest ¶
HandshakeRequest -
type Invocation ¶
type Invocation struct { Message Target string `json:"target"` Arguments []stdJSON.RawMessage `json:"arguments"` StreamsID []string `json:"streamIds,omitempty"` }
Invocation - a `Invocation` message
func NewInvocation ¶
func NewInvocation(id, target string, args ...interface{}) Invocation
NewInvocation -
type JSONEncoding ¶
type JSONEncoding struct { }
JSONEncoding -
func (*JSONEncoding) Decode ¶
func (e *JSONEncoding) Decode(data []byte) (interface{}, error)
Decode -
func (*JSONEncoding) Encode ¶
func (e *JSONEncoding) Encode(msg interface{}) ([]byte, error)
Encode -
type JSONReader ¶ added in v0.1.1
type JSONReader struct {
// contains filtered or unexported fields
}
JSONReader -
type Message ¶
type Message struct { Type ID string `json:"invocationId"` Headers map[string]string `json:"headers,omitempty"` }
Message -
type MessageType ¶
type MessageType int
MessageType -
const ( MessageTypeInvocation MessageType = iota + 1 MessageTypeStreamItem MessageTypeCompletion MessageTypeStreamInvocation MessageTypeCancelInvocation MessageTypePing MessageTypeCloseMessage )
type NegotiateResponse ¶
type NegotiateResponse struct { ConnectionToken string `json:"connectionToken"` ConnectionID string `json:"connectionId"` NegotiateVersion int `json:"negotiateVersion"` AvailableTransports []AvailableTransport `json:"availableTransports"` }
NegotiateResponse -
type RedirectResponse ¶
RedirectResponse -
type SignalR ¶
type SignalR struct {
// contains filtered or unexported fields
}
SignalR -
func (*SignalR) Messages ¶
func (s *SignalR) Messages() <-chan interface{}
Messages - listens message channel
func (*SignalR) SetOnReconnect ¶
SetOnReconnect -
type StreamInvocation ¶
type StreamInvocation Invocation
StreamInvocation - a `StreamInvocation` message
type StreamItem ¶
StreamItem - a `StreamItem` message
Click to show internal directories.
Click to hide internal directories.