chat

package
v0.0.0-...-8b501b0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Publisher

type Publisher interface {
	Publish(userID, message string) error
}

Publisher is implemented by objects that can send a message to a user.

type Room

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

Room models a chat room.

func NewRoom

func NewRoom(pub Publisher) *Room

NewRoom creates a new chat root instance that ued pub to broadcast messages.

func (*Room) AddUser

func (r *Room) AddUser(user string)

AddUser appends user to the room user list.

func (*Room) Broadcast

func (r *Room) Broadcast(message string) error

Broadcast message to all users currently in the room.

Jump to

Keyboard shortcuts

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