Documentation
¶
Index ¶
- type StreamInterface
- type StreamWrapper
- func (sw *StreamWrapper) Call(rq *simplejson.Json) (*simplejson.Json, error)
- func (sw *StreamWrapper) Connect() (*StreamWrapper, error)
- func (sw *StreamWrapper) DisableAutoReconnect()
- func (sw *StreamWrapper) Disconnect()
- func (sw *StreamWrapper) EnableAutoReconnect() StreamInterface
- func (sw *StreamWrapper) GetConnection() web_socket.WebSocketInterface
- func (sw *StreamWrapper) ListOfSubscriptions() ([]string, error)
- func (sw *StreamWrapper) Reconnect(maxAttempts int, delay time.Duration) error
- func (sw *StreamWrapper) SetMaxReconnectAttempts(n int) StreamInterface
- func (sw *StreamWrapper) SetMessageLogger(logger func(message web_socket.LogRecord)) StreamInterface
- func (sw *StreamWrapper) SetPingHandler(handler func(string) error)
- func (sw *StreamWrapper) SetPongHandler(handler func(string) error)
- func (sw *StreamWrapper) SetReadTimeout(timeout time.Duration) StreamInterface
- func (sw *StreamWrapper) SetReconnectInterval(interval time.Duration) StreamInterface
- func (sw *StreamWrapper) SetWriteTimeout(timeout time.Duration) StreamInterface
- func (sw *StreamWrapper) Subscribe(f func(web_socket.MessageEvent), subs ...string) error
- func (sw *StreamWrapper) Unsubscribe(subs ...string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StreamInterface ¶ added in v0.2.37
type StreamInterface interface { // Connect establishes a WebSocket connection and starts the stream Connect() (*StreamWrapper, error) // Reconnect recreates the connection with retry attempts Reconnect(maxAttempts int, delay time.Duration) error // Disconnect closes the WebSocket connection Disconnect() // Subscribe sends a business-level subscription (e.g., to Binance) Subscribe(f func(web_socket.MessageEvent), subscriptions ...string) error // Unsubscribe removes a subscription from the business stream Unsubscribe(subscriptions ...string) error // ListOfSubscriptions returns the current business-level subscriptions ListOfSubscriptions() ([]string, error) // GetConnection returns the underlying WebSocketInterface, if it needs to be passed further GetConnection() web_socket.WebSocketInterface // SetMaxReconnectAttempts sets the maximum number of reconnect attempts SetMaxReconnectAttempts(n int) StreamInterface // SetReconnectInterval sets the interval between reconnect attempts SetReconnectInterval(interval time.Duration) StreamInterface // EnableAutoReconnect enables automatic reconnection EnableAutoReconnect() StreamInterface // DisableAutoReconnect disables automatic reconnection DisableAutoReconnect() // SetMessageLogger sets a function for logging messages SetMessageLogger(logger func(message web_socket.LogRecord)) StreamInterface }
StreamInterface describes only the business-level logic for working with streams
type StreamWrapper ¶ added in v0.2.23
type StreamWrapper struct {
// contains filtered or unexported fields
}
func NewStreamWrapper ¶ added in v0.2.37
func NewStreamWrapper( factory func() (web_socket.WebSocketInterface, error), wsScheme common.WsScheme, wsHost common.WsHost, wsEndpoint common.WsEndpoint, timeOut ...time.Duration) *StreamWrapper
NewStreamWrapper creates a new StreamWrapper with a socket factory
func (*StreamWrapper) Call ¶ added in v0.2.26
func (sw *StreamWrapper) Call(rq *simplejson.Json) (*simplejson.Json, error)
func (*StreamWrapper) Connect ¶ added in v0.2.35
func (sw *StreamWrapper) Connect() (*StreamWrapper, error)
func (*StreamWrapper) DisableAutoReconnect ¶ added in v0.2.35
func (sw *StreamWrapper) DisableAutoReconnect()
func (*StreamWrapper) Disconnect ¶ added in v0.2.37
func (sw *StreamWrapper) Disconnect()
func (*StreamWrapper) EnableAutoReconnect ¶ added in v0.2.35
func (sw *StreamWrapper) EnableAutoReconnect() StreamInterface
func (*StreamWrapper) GetConnection ¶ added in v0.2.35
func (sw *StreamWrapper) GetConnection() web_socket.WebSocketInterface
func (*StreamWrapper) ListOfSubscriptions ¶ added in v0.2.23
func (sw *StreamWrapper) ListOfSubscriptions() ([]string, error)
func (*StreamWrapper) Reconnect ¶ added in v0.2.35
func (sw *StreamWrapper) Reconnect(maxAttempts int, delay time.Duration) error
func (*StreamWrapper) SetMaxReconnectAttempts ¶ added in v0.2.35
func (sw *StreamWrapper) SetMaxReconnectAttempts(n int) StreamInterface
func (*StreamWrapper) SetMessageLogger ¶ added in v0.2.37
func (sw *StreamWrapper) SetMessageLogger(logger func(message web_socket.LogRecord)) StreamInterface
func (*StreamWrapper) SetPingHandler ¶ added in v0.2.36
func (sw *StreamWrapper) SetPingHandler(handler func(string) error)
func (*StreamWrapper) SetPongHandler ¶ added in v0.2.36
func (sw *StreamWrapper) SetPongHandler(handler func(string) error)
func (*StreamWrapper) SetReadTimeout ¶ added in v0.2.38
func (sw *StreamWrapper) SetReadTimeout(timeout time.Duration) StreamInterface
func (*StreamWrapper) SetReconnectInterval ¶ added in v0.2.37
func (sw *StreamWrapper) SetReconnectInterval(interval time.Duration) StreamInterface
func (*StreamWrapper) SetWriteTimeout ¶ added in v0.2.38
func (sw *StreamWrapper) SetWriteTimeout(timeout time.Duration) StreamInterface
func (*StreamWrapper) Subscribe ¶ added in v0.2.23
func (sw *StreamWrapper) Subscribe(f func(web_socket.MessageEvent), subs ...string) error
func (*StreamWrapper) Unsubscribe ¶ added in v0.2.23
func (sw *StreamWrapper) Unsubscribe(subs ...string) error
Click to show internal directories.
Click to hide internal directories.