channel

package module
v0.0.0-...-7c56576 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2019 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoContextOrSocket = errors.New("You need to provide a valid Context and Socket channel")

ErrNoContextOrSocket is returned when there are missing parameters in the Join function

Functions

This section is empty.

Types

type Channel

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

Channel holds the channel information

func NewChannel

func NewChannel() Channel

NewChannel builds a new channel

func (Channel) Broadcast

func (c Channel) Broadcast(cmd wit.Command, blacklistClientIDs ...string)

Broadcast sends a message to the whole channel except for the provided IDs

func (Channel) Join

func (c Channel) Join(options JoinOptions)

Join adds a client to the channel, waits until the context is done and removes it

func (Channel) Send

func (c Channel) Send(cmd wit.Command, clientIDs ...string)

Send sends a message to a list of clients

type JoinOptions

type JoinOptions interface {
	CmdCh() chan<- wit.Command
	ClientID() string
	context.Context
}

JoinOptions includes the list of options that Join accepts

Jump to

Keyboard shortcuts

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