hub

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2022 License: MIT Imports: 5 Imported by: 1

Documentation

Index

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 stores all the sessions and the corresponding subscriptions info

func NewHub

func NewHub(poolSize int) *Hub

NewHub builds new hub instance

func (*Hub) AddSession

func (h *Hub) AddSession(session HubSession)

func (*Hub) Broadcast

func (h *Hub) Broadcast(stream string, data string)

Broadcast enqueues data broadcasting to a stream

func (*Hub) BroadcastMessage

func (h *Hub) BroadcastMessage(msg *common.StreamMessage)

BroadcastMessage enqueues broadcasting a pre-built StreamMessage

func (*Hub) DisconnectSesssions

func (h *Hub) DisconnectSesssions(msg encoders.EncodedMessage, code string)

func (*Hub) FindByIdentifier

func (h *Hub) FindByIdentifier(id string) HubSession

func (*Hub) RemoteDisconnect

func (h *Hub) RemoteDisconnect(msg *common.RemoteDisconnectMessage)

RemoteDisconnect enqueues remote disconnect command

func (*Hub) RemoveSession

func (h *Hub) RemoveSession(session HubSession)

func (*Hub) RemoveSessionLater

func (h *Hub) RemoveSessionLater(s HubSession)

RemoveSession enqueues session un-registration

func (*Hub) Run

func (h *Hub) Run()

Run makes hub active

func (*Hub) Shutdown

func (h *Hub) Shutdown()

Shutdown sends shutdown command to hub

func (*Hub) Size

func (h *Hub) Size() int

Size returns a number of active sessions

func (*Hub) StreamsSize

func (h *Hub) StreamsSize() int

StreamsSize returns a number of uniq streams

func (*Hub) SubscribeSession

func (h *Hub) SubscribeSession(sid string, stream string, identifier string)

func (*Hub) UniqSize

func (h *Hub) UniqSize() int

UniqSize returns a number of uniq identifiers

func (*Hub) UnsubscribeSession

func (h *Hub) UnsubscribeSession(sid string, stream string, identifier string)

func (*Hub) UnsubscribeSessionFromChannel

func (h *Hub) UnsubscribeSessionFromChannel(sid string, identifier string)

type HubRegistration

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

HubRegistration represents registration event ("add" or "remove")

type HubSession

type HubSession interface {
	GetID() string
	GetIdentifiers() string
	Send(msg encoders.EncodedMessage)
	DisconnectWithMessage(msg encoders.EncodedMessage, code string)
}

type HubSubscription

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

HubSubscription contains information about session-channel(-stream) subscription

Jump to

Keyboard shortcuts

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