Documentation ¶
Index ¶
- Variables
- func InitLogic() (err error)
- func InitWebsocket(s *Server, c *conf.WebsocketConf) (err error)
- type Bucket
- type BucketOptions
- type Channel
- type ConnectArg
- type ConnectReply
- type DefaultOperator
- type DisconnectArg
- type DisconnectReply
- type Operator
- type Proto
- type Room
- type RoomMsgArg
- type Server
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrRoomIsDropped = errors.New("room is dropped")
ErrRoomIsDropped is err for room is dropped
View Source
var NoRoom = "NoRoom"
NoRoom is flag
Functions ¶
func InitWebsocket ¶
func InitWebsocket(s *Server, c *conf.WebsocketConf) (err error)
InitWebsocket is func to initial Websocket
Types ¶
type Bucket ¶
type Bucket struct {
// contains filtered or unexported fields
}
Bucket is struct of Bucket
func (*Bucket) BroadcastRoom ¶
func (b *Bucket) BroadcastRoom(arg *RoomMsgArg)
BroadcastRoom is used to broadcast room
func (*Bucket) PushRoom ¶
func (b *Bucket) PushRoom(c chan *RoomMsgArg)
PushRoom is func to push room msg
type BucketOptions ¶
BucketOptions is struct of Bucket Config
type Channel ¶
type Channel struct { Room *Room Next *Channel Prev *Channel // contains filtered or unexported fields }
Channel is struct of channel
type ConnectArg ¶
ConnectArg is rpc connect arg
type ConnectReply ¶
type ConnectReply struct {
UID string
}
ConnectReply is struct for Connect reply
type DefaultOperator ¶
type DefaultOperator struct{}
DefaultOperator is default operator
func (*DefaultOperator) Connect ¶
func (operator *DefaultOperator) Connect(ctx context.Context, c *ConnectArg) (uid string, err error)
Connect is func to Connect
func (*DefaultOperator) Disconnect ¶
func (operator *DefaultOperator) Disconnect(ctx context.Context, d *DisconnectArg) (err error)
Disconnect is func to Disconnect
type DisconnectArg ¶
DisconnectArg is rpc disconnect arg
type DisconnectReply ¶
type DisconnectReply struct {
Has bool
}
DisconnectReply is struct for Disconnect reply
type Operator ¶
type Operator interface { Connect(context.Context, *ConnectArg) (string, error) Disconnect(context.Context, *DisconnectArg) error }
Operator is interface for operation
type Proto ¶
type Proto struct { Ver int16 `json:"ver"` // protocol version Operation int32 `json:"op"` // operation for request Body json.RawMessage `json:"body"` // binary body bytes(json.RawMessage is []byte) }
Proto is struct for msg protocol
Source Files ¶
Click to show internal directories.
Click to hide internal directories.