Documentation ¶
Index ¶
Constants ¶
View Source
const ( PingEvent = "Ping" DataEvent = "Data" WindowsEvent = "Windows" JoinEvent = "Join" LeaveEvent = "Leave" ExitEvent = "Exit" JoinSuccessEvent = "JoinSuccess" ActionEvent = "Action" )
View Source
const ( ZmodemStartEvent = "ZMODEM_START" ZmodemEndEvent = "ZMODEM_END" )
Variables ¶
This section is empty.
Functions ¶
func UnRegister ¶
func UnRegister(r *Room)
Types ¶
type Config ¶
type Config struct { // Defaults to "tcp". Network string // Addr of a single redis server instance. // See "Clusters" field for clusters support. // Defaults to "127.0.0.1:6379". Addr string // Clusters a list of network addresses for clusters. // If not empty "Addr" is ignored. Clusters []string Password string DialTimeout time.Duration // MaxActive defines the size connection pool. // Defaults to 10. MaxActive int DBIndex int }
type Conn ¶
func WrapperUserCon ¶
type MetaMessage ¶
type Room ¶
type Room struct { Id string // contains filtered or unexported fields }
func CreateRoom ¶
func CreateRoom(id string, inChan chan *RoomMessage) *Room
func (*Room) Broadcast ¶
func (r *Room) Broadcast(msg *RoomMessage)
func (*Room) Receive ¶
func (r *Room) Receive(msg *RoomMessage)
func (*Room) UnSubscribe ¶
type RoomManager ¶
type RoomMessage ¶
type RoomMessage struct { Event string `json:"event"` Body []byte `json:"data"` Meta MetaMessage `json:"meta"` // receive的信息必须携带Meta }
func (RoomMessage) Marshal ¶
func (m RoomMessage) Marshal() []byte
type Stream ¶
type Stream interface { io.WriteCloser HandleRoomEvent(event string, msg *RoomMessage) }
Click to show internal directories.
Click to hide internal directories.