You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

37 lines
679 B

package connect
import (
"gopkg.in/olahol/melody.v1"
)
type Client struct {
Id string // account_typ:account_id
AccountId int64
AccountType string
Pid int64
Online bool
RoomId string
node *Node
*melody.Session
}
func NewClient(session *melody.Session, node *Node, roomId string) *Client {
client := new(Client)
client.Session = session
client.node = node
client.Online = false
client.RoomId = roomId
return client
}
func (c *Client) BroadcastAll(msg *Message) {
c.node.BroadcastAll(msg, c)
}
func (c *Client) Register() error {
return c.node.RegisterClient(c)
}
func (c *Client) Send(msg *Message) {
c.node.Send(msg)
}