rooms

package
v0.0.0-...-e913a2f Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(ws *websocket.Conn)

func IDChan

func IDChan() <-chan (string)

Types

type Cmd

type Cmd struct {
	Action string `json:"action"`
	Data   string `json:"data,omitempty"`
}

type Message

type Message struct {
	Type string `json:"type,omitempty"`
	Data string `json:"data,omitempty"`
	To   string `json:"to,omitempty"`
	From string `json:"from,omitempty"`
}

type Room

type Room struct {
	Name  string           `json:"name"`
	Users map[string]*User `json:"users"`
}

func (*Room) Info

func (r *Room) Info() string

func (*Room) Join

func (r *Room) Join(u *User)

func (*Room) Leave

func (r *Room) Leave(u *User)

func (*Room) Send

func (r *Room) Send(m Message)

func (*Room) SendInfo

func (r *Room) SendInfo()

func (*Room) SendOthers

func (r *Room) SendOthers(m Message, sender *User)

func (*Room) SendPrivateMessage

func (r *Room) SendPrivateMessage(m Message)

type User

type User struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Room *Room  `json:"-"`
	// contains filtered or unexported fields
}

func (*User) Send

func (u *User) Send(m Message)

func (*User) SendInfo

func (u *User) SendInfo()

Jump to

Keyboard shortcuts

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