websockets

package
v0.0.0-...-bbafd50 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2018 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Overview

Package websockets handles websocket messages and provides a simple websockets server.

Index

Constants

View Source
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

func NotificationBlockHandler(hub *Hub, client *rpcclient.Client, blockID string)

NotificationBlockHandler used to notify blocks

func NotificationMempoolHandler

func NotificationMempoolHandler(hub *Hub, client *rpcclient.Client, txID string)

NotificationMempoolHandler used to notify mempool blocks

func Run

func Run(hub *Hub, client *rpcclient.Client) *http.ServeMux

Run creates a notification server

func ServeWs

func ServeWs(hub *Hub, w http.ResponseWriter, r *http.Request, rpcClient *rpcclient.Client)

ServeWs handles websocket requests from the peer.

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.

func NewHub

func NewHub() *Hub

NewHub creates a new hub to track messages about clients

func (*Hub) Run

func (h *Hub) Run()

Run runs the hub forever

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

Jump to

Keyboard shortcuts

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