MessageHub

package
v0.0.0-...-467dd59 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServeMessageWs

func ServeMessageWs(feedId string, hub *MessageHub, w http.ResponseWriter, r *http.Request, pingInterval int)

ServeMessageWs serveWs handles websocket requests from the peer.

Types

type MessageClient

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

MessageClient Client is a middleman between the websocket connection and the hub.

type MessageEvent

type MessageEvent struct {
	FeedId  string           `json:"feedId"`
	Message *msProto.Message `json:"message"`
}

type MessageHub

type MessageHub struct {
	// Registered clients.
	Clients map[*MessageClient]bool

	// Inbound messages from the clients.
	Broadcast chan MessageEvent

	// Register requests from the clients.
	Register chan *MessageClient

	Quit chan bool
	// contains filtered or unexported fields
}

MessageHub Hub maintains the set of active clients and broadcasts messages to the clients.

func NewMessageHub

func NewMessageHub() *MessageHub

func (*MessageHub) Run

func (h *MessageHub) Run()

type Time

type Time struct {
	Seconds string `json:"seconds"`
	Nanos   string `json:"nanos"`
}

Jump to

Keyboard shortcuts

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