Documentation ¶
Overview ¶
Package websockets handles websocket messages and provides a simple websockets server.
Index ¶
- Constants
- func NotificationBlockHandler(hub *Hub, client *rpcclient.Client, blockID string)
- func NotificationMempoolHandler(hub *Hub, client *rpcclient.Client, txID string)
- func Run(hub *Hub, client *rpcclient.Client) *http.ServeMux
- func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request, rpcClient *rpcclient.Client)
- type BroadcastAddressMessage
- type BroadcastTransactionMessage
- type Client
- type Hub
- type IncludeTransaction
- type RegisterAddress
- type RegisterBloom
Constants ¶
const ( // IncludeAllTransactions - Include both confirmed and mempool transactions IncludeAllTransactions = IncludeTransaction(iota) // IncludeMempoolTransactions - Include only mempool transactions IncludeMempoolTransactions = IncludeTransaction(iota) // IncludeConfirmedTransactions - Include only confirmed transaction IncludeConfirmedTransactions = IncludeTransaction(iota) )
Variables ¶
This section is empty.
Functions ¶
func NotificationBlockHandler ¶
NotificationBlockHandler used to notify blocks
func NotificationMempoolHandler ¶
NotificationMempoolHandler used to notify mempool blocks
Types ¶
type BroadcastAddressMessage ¶
type BroadcastAddressMessage struct {
// contains filtered or unexported fields
}
BroadcastAddressMessage used to receive message of addresses
type BroadcastTransactionMessage ¶
type BroadcastTransactionMessage struct {
// contains filtered or unexported fields
}
BroadcastTransactionMessage is used to receive messages of transactions
type Client ¶
type Client struct { Hub *Hub // The websocket connection. Conn *websocket.Conn // contains filtered or unexported fields }
Client is a middleman between the websocket connection and the hub.
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub maintains the set of active clients and broadcasts messages to the clients.
type IncludeTransaction ¶
type IncludeTransaction int
IncludeTransaction is whether to include mempool transactions, confirmed transactions, or all
type RegisterAddress ¶
type RegisterAddress struct {
// contains filtered or unexported fields
}
RegisterAddress is a channel used to register an address to a websocket client
type RegisterBloom ¶
type RegisterBloom struct {
// contains filtered or unexported fields
}
RegisterBloom is a channel message used to register a bloom filter