Documentation ¶
Index ¶
- Constants
- Variables
- type ConnectedEvent
- type ConnectingEvent
- type DialTimeoutEvent
- type DisconnectedEvent
- type Option
- func SetAutoReconnectEnabled(enabled bool) Option
- func SetAutoReconnectMaxDelay(delay time.Duration) Option
- func SetDialTimeout(timeout time.Duration) Option
- func SetMonitor(monitorChan chan<- interface{}) Option
- func SetReadTimeout(timeout time.Duration) Option
- func SetReadWriteTimeout(timeout time.Duration) Option
- func SetWriteTimeout(timeout time.Duration) Option
- type Transport
Constants ¶
const ( DefaultDialTimeout = 30 * time.Second DefaultAutoReconnectMaxDelay = 5 * time.Minute )
Variables ¶
var (
ErrClosing = errors.New("closing")
)
Functions ¶
This section is empty.
Types ¶
type ConnectedEvent ¶ added in v0.2.0
type ConnectedEvent struct {
URL string
}
ConnectedEvent is emitted when the WebSocket connection is established.
func (*ConnectedEvent) String ¶ added in v0.2.0
func (e *ConnectedEvent) String() string
type ConnectingEvent ¶ added in v0.2.0
type ConnectingEvent struct {
URL string
}
ConnectingEvent is emitted when a new connection is being established.
func (*ConnectingEvent) String ¶ added in v0.2.0
func (e *ConnectingEvent) String() string
type DialTimeoutEvent ¶ added in v0.2.0
DialTimeoutEvent is emitted when establishing a new connection times out.
func (*DialTimeoutEvent) String ¶ added in v0.2.0
func (e *DialTimeoutEvent) String() string
type DisconnectedEvent ¶ added in v0.2.0
DisconnectedEvent is emitted when the WebSocket connection is lost.
func (*DisconnectedEvent) String ¶ added in v0.2.0
func (e *DisconnectedEvent) String() string
type Option ¶ added in v0.2.0
type Option func(*Transport)
Option represents an option that can be passed into the transport constructor.
func SetAutoReconnectEnabled ¶ added in v0.2.0
SetAutoReconnectEnabled can be used to enable automatic reconnection to the RPC endpoint. Exponential backoff is used when the connection cannot be established repetitively.
See SetAutoReconnectMaxDelay to set the maximum delay between the reconnection attempts.
func SetAutoReconnectMaxDelay ¶ added in v0.2.0
SetAutoReconnectMaxDelay can be used to set the maximum delay between the reconnection attempts.
This option only takes effect when the auto-reconnect mode is enabled.
The default value is 5 minutes.
func SetDialTimeout ¶ added in v0.2.0
SetDialTimeout can be used to set the timeout when establishing a new connection.
func SetMonitor ¶ added in v0.2.0
func SetMonitor(monitorChan chan<- interface{}) Option
SetMonitor can be used to set the monitoring channel that can be used to watch connection-related state changes.
All channel send operations are happening synchronously, so not receiving messages from the channel will lead to the whole thing getting stuck completely.
This option only takes effect when the auto-reconnect mode is enabled.
The channel is closed when the transport is closed.
func SetReadTimeout ¶ added in v0.2.0
SetReadTimeout sets the connection read timeout. The timeout is implemented using net.Conn.SetReadDeadline.
func SetReadWriteTimeout ¶ added in v0.2.0
SetReadWriteTimeout sets the connection read and write timeout. The timeout is implemented using net.Conn.SetDeadline.
func SetWriteTimeout ¶ added in v0.2.0
SetWriteTimeout sets the connection read timeout. The timeout is implemented using net.Conn.SetWriteDeadline.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport implements a CallCloser accessing the Steem RPC endpoint over WebSocket.
func NewTransport ¶ added in v0.2.0
NewTransport creates a new transport that connects to the given WebSocket URL.