websocket

package
v0.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type WsClient

type WsClient struct {
	Stream chan *WsEvent
	Errors chan error
	// contains filtered or unexported fields
}

func NewWsClient

func NewWsClient(options ...WsOption) (*WsClient, error)

func (*WsClient) Close

func (c *WsClient) Close()

func (*WsClient) IsReconnectRequest

func (c *WsClient) IsReconnectRequest(event *WsEvent) bool

Determines whether server is requesting reconnect. If such a request is made by the server, we should immediately reconnect. Note: Bitstamp ensures, that once such a request is received by the client, any new websocket client is connected to a healthy server.

func (*WsClient) Subscribe

func (c *WsClient) Subscribe(channels ...string)

func (*WsClient) Unsubscribe

func (c *WsClient) Unsubscribe(channels ...string)

type WsEvent

type WsEvent struct {
	Event   string      `json:"event"`
	Channel string      `json:"channel"`
	Data    interface{} `json:"data"`
}

type WsOption

type WsOption func(*wsClientConfig)

func Timeout

func Timeout(timeout time.Duration) WsOption

func WsUrl

func WsUrl(domain string) WsOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL