Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BroadcastError ¶
type BroadcastError struct { //Err raw error. Err error //Conn connections in which error raised. Conn connections.OutputConnection //Room room in which error raised. Room *Room }
BroadcastError room broadcast error
func (*BroadcastError) Error ¶
func (e *BroadcastError) Error() string
type Joinable ¶
type Joinable interface { Join(roomid string, conn connections.OutputConnection) Leave(roomid string, conn connections.OutputConnection) }
Joinable interfacer for which can joined as room manager.
type Location ¶
type Location struct {
// contains filtered or unexported fields
}
Location room data of user.
func NewLocation ¶
func NewLocation(conn connections.OutputConnection, rooms Joinable) *Location
NewLocation create new loction with given connection and rooms.
type Room ¶
Room connection room in which all connections will receive broadcast.
func (*Room) Broadcast ¶
Broadcast broadcast message to all connection in room. Return BroadcastError if any error raised.
func (*Room) Join ¶
func (r *Room) Join(conn connections.OutputConnection) bool
Join join connection to room.
func (*Room) Leave ¶
func (r *Room) Leave(conn connections.OutputConnection) bool
Leave leave connection from room.
func (*Room) Members ¶
func (r *Room) Members() []connections.OutputConnection
Members list room connections.
type Rooms ¶
Rooms rooms manager
func (*Rooms) Broadcast ¶
Broadcast brodcat message to give room. BroadcastError will be sent to Error chan if any error raised.
func (*Rooms) Join ¶
func (r *Rooms) Join(roomid string, conn connections.OutputConnection)
Join join connection to room by given room id. Auto create room if not exists.
func (*Rooms) Leave ¶
func (r *Rooms) Leave(roomid string, conn connections.OutputConnection)
Leave leave connection form room by give room id. Auto remove room if root empty.
func (*Rooms) Members ¶
func (r *Rooms) Members(roomid string) []connections.OutputConnection
Members list connections in room by given room id.