Documentation
¶
Index ¶
- type Hub
- func (h *Hub) AddSubscription(subId uint64, conn net.Conn, topics ...string) uint32
- func (h *Hub) Evict(ctx context.Context, running chan struct{})
- func (h *Hub) Listen(ctx context.Context, addr string, done chan bool)
- func (h *Hub) Next() *ops.Msg
- func (h *Hub) Process(ctx context.Context, running chan struct{})
- func (h *Hub) Publish(msg *ops.Msg) uint32
- func (h *Hub) Queued() bool
- func (h *Hub) Subscribe(conn net.Conn, topics ...string) (uint64, uint32)
- func (h *Hub) Unsubscribe(subId uint64, topics ...string) uint32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
Hub - Abstraction between message publishers & subscribers, works as a multiplexer ( or router )
func (*Hub) AddSubscription ¶
AddSubscription - Subscriber showing intent of receiving messages from a non-empty set of topics [ on-the-fly i.e. after subscriber has been registered ]
func (*Hub) Evict ¶
Evict - As soon as it's determined peer is not anymore connected & it didn't follow graceful tear down ( didn't unsubscribe from topics ) its entry from subscription table to be evicted
func (*Hub) Listen ¶
Listen - Hub listens for TCP connections, accepts those & spawns new go routine for handling each of those
func (*Hub) Process ¶
Process - Listens for new message ready to published & works on publishing it to all topic subscribers
func (*Hub) Publish ¶
Publish - Message publish request to be enqueued for some worker to process, while this function will calcalate how many clients will receive this message & respond back