web

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MsgNewSale  = "new_event"
	MsgGasPrice = "gas_price"

	MsgCommand = "cmd"
)

Variables

View Source
var (
	ErrEventNotSupported = errors.New("this event type is not supported")
)

* wsUpgrader is used to upgrade incomming HTTP requests into a persitent websocket connection

Functions

func StartWebUI added in v0.4.0

func StartWebUI(queueWsOutTokenTransactions chan *totra.TokenTransaction)

Types

type GasPriceMessage added in v0.5.0

type GasPriceMessage struct {
	Normal float64 `json:"normal"`
	Fast   float64 `json:"fast"`
}

payloads for message types

type Message added in v0.5.0

type Message struct {
	// Type is the message type sent
	Type string `json:"type"`
	// Payload is the data Based on the Type
	Payload any `json:"payload"`
}

Message is the Messages sent over the websocket Used to differ between different actions

type MessageHandler added in v0.5.0

type MessageHandler func(message Message, c *WsClient) error

MessageHandler is a function signature that is used to affect messages on the socket and triggered depending on the type

type MessagePayload added in v0.5.0

type MessagePayload json.RawMessage

type NewEventMessage added in v0.5.0

type NewEventMessage struct {
	Message string `json:"message"`
	From    string `json:"from"`
}

payloads for message types

type SendMessageMessage added in v0.5.0

type SendMessageMessage struct {
	Message string `json:"message"`
	From    string `json:"from"`
}

SendMessageMessage is the payload sent in the send_message message

type WsClient added in v0.4.0

type WsClient struct {
	// contains filtered or unexported fields
}

func NewClient added in v0.4.0

func NewClient(conn net.Conn, hub *WsHub) *WsClient

NewClient is used to initialize a new Client with all required values initialized

type WsHub added in v0.4.0

type WsHub struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewHub added in v0.4.0

func NewHub(queueWsOutTokenTransactions chan *totra.TokenTransaction) *WsHub

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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