internal

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version is set at build time via -ldflags "-X github.com/GoCodeAlone/workflow-plugin-rooms/internal.Version=X.Y.Z"

Functions

func NewRoomsPlugin

func NewRoomsPlugin() sdk.PluginProvider

NewRoomsPlugin returns the rooms SDK plugin provider.

func SetGlobalHub

func SetGlobalHub(h *Hub)

SetGlobalHub sets the global hub (called by the module on Init).

Types

type Hub

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

Hub implements RoomHub with a concurrent-safe room registry.

func GetGlobalHub

func GetGlobalHub() *Hub

GetGlobalHub returns the global room hub once the rooms.manager module has initialized.

func NewHub

func NewHub() *Hub

NewHub creates a new room hub.

func (*Hub) BroadcastToRoom

func (h *Hub) BroadcastToRoom(room string, msg []byte, excludeConnID string) int

BroadcastToRoom sends msg to all connections in room (optionally excluding one). Returns the number of recipients that accepted the message.

func (*Hub) GetMembers

func (h *Hub) GetMembers(room string) []string

GetMembers returns a list of connection IDs in the named room.

func (*Hub) JoinRoom

func (h *Hub) JoinRoom(room, connID string) bool

JoinRoom adds connID to the named room. Returns true if the connection was registered.

func (*Hub) LeaveAllRooms

func (h *Hub) LeaveAllRooms(connID string)

LeaveAllRooms removes connID from every room it belongs to.

func (*Hub) LeaveRoom

func (h *Hub) LeaveRoom(room, connID string)

LeaveRoom removes connID from the named room.

func (*Hub) RegisterConnection

func (h *Hub) RegisterConnection(connID string)

RegisterConnection registers a connection ID so it can join rooms.

func (*Hub) SetSendFunc

func (h *Hub) SetSendFunc(f func(connID string, msg []byte) bool)

SetSendFunc installs the function used by BroadcastToRoom to deliver messages.

func (*Hub) UnregisterConnection

func (h *Hub) UnregisterConnection(connID string)

UnregisterConnection removes a connection from all rooms and cleans up.

type RoomHub

type RoomHub interface {
	JoinRoom(room, connID string) bool
	LeaveRoom(room, connID string)
	LeaveAllRooms(connID string)
	BroadcastToRoom(room string, msg []byte, excludeConnID string) int
	GetMembers(room string) []string
	RegisterConnection(connID string)
	UnregisterConnection(connID string)
}

RoomHub is the public interface for room management.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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