web

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

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

	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 HandlerManifoldSNSTopic added in v0.11.1

func HandlerManifoldSNSTopic(w http.ResponseWriter, r *http.Request)

func StartmanifoldSNS added in v0.11.1

func StartmanifoldSNS()

Types

type EventPayload added in v0.10.0

type EventPayload struct {
	Message string `json:"message"`
}

payloads for message types.

type ManifoldSNSMessage added in v0.11.1

type ManifoldSNSMessage struct {
	Subject                string             `json:"Subject"`
	Message                ManifoldSNSPayload `json:"Message"`
	MessageGroupID         string             `json:"MessageGroupId"`
	MessageDeduplicationID string             `json:"MessageDeduplicationId"`
}

type ManifoldSNSPayload added in v0.11.1

type ManifoldSNSPayload struct {
	CreatorAddress common.Address `json:"creatorAddress"`
	Link           string         `json:"link"`
	NetworkID      int64          `json:"networkId"`
}

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 *json.RawMessage `json:"payload"`
}

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

type MessageGeneric added in v0.10.0

type MessageGeneric[T interface{}] struct {
	// Type is the message type sent
	Type string `json:"type"`

	// Payload is the data Based on the Type
	Payload T `json:"payload"`

	// Current Gas Price
	GasPrice uint64 `json:"gas_price"`
}

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 SNSMessage added in v0.11.1

type SNSMessage struct {
	MessageID     string `json:"messageId"`
	ReceiptHandle string `json:"receiptHandle"`
	Body          string `json:"body"`
	// Body          json.RawMessage `json:"body"`
	// Body       ManifoldSNSMessage `json:"body"`
	Attributes struct {
		ApproximateReceiveCount          string `json:"ApproximateReceiveCount"`
		AWSTraceHeader                   string `json:"AWSTraceHeader"`
		SentTimestamp                    string `json:"SentTimestamp"`
		SequenceNumber                   string `json:"SequenceNumber"`
		MessageGroupID                   string `json:"MessageGroupId"`
		SenderID                         string `json:"SenderId"`
		MessageDeduplicationID           string `json:"MessageDeduplicationId"`
		ApproximateFirstReceiveTimestamp string `json:"ApproximateFirstReceiveTimestamp"`
	} `json:"attributes"`
	MessageAttributes struct{} `json:"messageAttributes"`
	Md5OfBody         string   `json:"md5OfBody"`
	EventSource       string   `json:"eventSource"`
	EventSourceARN    string   `json:"eventSourceARN"`
	AwsRegion         string   `json:"awsRegion"`
}

type UserInfo added in v0.10.0

type UserInfo struct {
	Name    string         `json:"username"`
	Address common.Address `json:"address"`
}

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.

func (*WsClient) String added in v0.11.0

func (wc *WsClient) String() string

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(gb *gloomberg.Gloomberg) *WsHub

func StartWebUI added in v0.4.0

func StartWebUI(gb *gloomberg.Gloomberg) (*WsHub, error)

func (*WsHub) ClientsOnline added in v0.11.0

func (wh *WsHub) ClientsOnline() uint64

ClientsOnline returns the number of clients that are currently connected.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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