Documentation ¶
Index ¶
- func DecodeMsg(msg *pstypes.WebSocketMessage) (interface{}, error)
- func DecodeMsgMempool(msg *pstypes.WebSocketMessage) (*exptypes.MempoolShort, error)
- func DecodeMsgNewAddressTx(msg *pstypes.WebSocketMessage) (*pstypes.AddressMessage, error)
- func DecodeMsgNewBlock(msg *pstypes.WebSocketMessage) (*exptypes.WebsocketBlock, error)
- func DecodeMsgPing(msg *pstypes.WebSocketMessage) (string, error)
- func DecodeMsgString(msg *pstypes.WebSocketMessage) (string, error)
- func DecodeMsgSubscribeResponse(msg *pstypes.WebSocketMessage) (string, error)
- func DecodeMsgTxList(msg *pstypes.WebSocketMessage) (*pstypes.TxList, error)
- func DecodeMsgUnsubscribeResponse(msg *pstypes.WebSocketMessage) (string, error)
- type Client
- func (c *Client) ReceiveMsg() (*pstypes.WebSocketMessage, error)
- func (c *Client) ReceiveMsgTimeout(timeout time.Duration) (*pstypes.WebSocketMessage, error)
- func (c *Client) ReceiveRaw() (message string, err error)
- func (c *Client) Subscribe(event string) (*pstypes.WebSocketMessage, error)
- func (c *Client) Unsubscribe(event string) (*pstypes.WebSocketMessage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeMsg ¶
func DecodeMsg(msg *pstypes.WebSocketMessage) (interface{}, error)
DecodeMsg attempts to decode the Message content of the given WebSocketMessage based on its EventId. The type contained in the returned interface{} depends on the EventId.
func DecodeMsgMempool ¶
func DecodeMsgMempool(msg *pstypes.WebSocketMessage) (*exptypes.MempoolShort, error)
DecodeMsgMempool attempts to decode the Message content of the given WebSocketMessage as a mempool message (*exptypes.MempoolShort).
func DecodeMsgNewAddressTx ¶
func DecodeMsgNewAddressTx(msg *pstypes.WebSocketMessage) (*pstypes.AddressMessage, error)
DecodeMsgNewAddressTx attempts to decode the Message content of the given WebSocketMessage as an address message (*DecodeMsgNewAddressTx).
func DecodeMsgNewBlock ¶
func DecodeMsgNewBlock(msg *pstypes.WebSocketMessage) (*exptypes.WebsocketBlock, error)
DecodeMsgNewBlock attempts to decode the Message content of the given WebSocketMessage as a newblock message (*exptypes.WebsocketBlock).
func DecodeMsgPing ¶
func DecodeMsgPing(msg *pstypes.WebSocketMessage) (string, error)
DecodeMsgPing attempts to decode the Message content of the given WebSocketMessage ping response message (string).
func DecodeMsgString ¶
func DecodeMsgString(msg *pstypes.WebSocketMessage) (string, error)
DecodeMsgString attempts to decode the Message content of the given WebSocketMessage as a string.
func DecodeMsgSubscribeResponse ¶
func DecodeMsgSubscribeResponse(msg *pstypes.WebSocketMessage) (string, error)
DecodeMsgSubscribeResponse attempts to decode the Message content of the given WebSocketMessage as a subscribe response message (string).
func DecodeMsgTxList ¶
func DecodeMsgTxList(msg *pstypes.WebSocketMessage) (*pstypes.TxList, error)
DecodeMsgTxList attempts to decode the Message content of the given WebSocketMessage as a newtxs message (*pstypes.TxList).
func DecodeMsgUnsubscribeResponse ¶
func DecodeMsgUnsubscribeResponse(msg *pstypes.WebSocketMessage) (string, error)
DecodeMsgUnsubscribeResponse attempts to decode the Message content of the given WebSocketMessage as an unsubscribe response message (string).
Types ¶
type Client ¶
Client wraps a *websocket.Conn.
func (*Client) ReceiveMsg ¶
func (c *Client) ReceiveMsg() (*pstypes.WebSocketMessage, error)
ReceiveMsg waits for a message, returned decoded into a WebSocketMessage. The Client's configured ReadTimeout is used.
func (*Client) ReceiveMsgTimeout ¶
ReceiveMsgTimeout waits for the specified time Duration for a message, returned decoded into a WebSocketMessage.
func (*Client) ReceiveRaw ¶
ReceiveRaw for a message, returned undecoded as a string.
func (*Client) Subscribe ¶
func (c *Client) Subscribe(event string) (*pstypes.WebSocketMessage, error)
Subscribe sends a subscribe type WebSocketMessage for the given event name after validating it. The response is returned.
func (*Client) Unsubscribe ¶
func (c *Client) Unsubscribe(event string) (*pstypes.WebSocketMessage, error)
Unsubscribe sends an unsubscribe type WebSocketMessage for the given event name after validating it. The response is returned.