user

package
v0.0.0-...-eedd7ff Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

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

func InitConn

func InitConn(wsCon *websocket.Conn) (*Connection, error)

func (*Connection) Close

func (c *Connection) Close()

func (*Connection) ReadMessage

func (c *Connection) ReadMessage() ([]byte, error)

func (*Connection) RemoteAddr

func (c *Connection) RemoteAddr() string

func (*Connection) WriteMessage

func (c *Connection) WriteMessage(b []byte) error

type Event

type Event struct {
	User *User
	Type EventType
}

type EventType

type EventType string
const (
	Authed EventType = "authed"
	Closed EventType = "closed"
)

type User

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

User connected

func InitUser

func InitUser(wsCon *websocket.Conn) (*User, error)

func (*User) Close

func (u *User) Close()

func (*User) HasAuthed

func (u *User) HasAuthed() bool

If user has authed, his name will be set

func (*User) Name

func (u *User) Name() string

func (*User) Read

func (u *User) Read() (*message.Message, error)

func (*User) RoomIds

func (u *User) RoomIds() map[string]bool

func (*User) SetName

func (u *User) SetName(name string)

func (*User) SetRoomIds

func (u *User) SetRoomIds(roomIds []string)

func (*User) SetUid

func (u *User) SetUid(uid string)

func (*User) String

func (u *User) String() string

func (*User) Uid

func (u *User) Uid() string

func (*User) Write

func (u *User) Write(m *message.Message) error

Jump to

Keyboard shortcuts

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