-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuserbase.go
More file actions
35 lines (28 loc) · 701 Bytes
/
userbase.go
File metadata and controls
35 lines (28 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package rose
import (
"github.com/golang/protobuf/proto"
)
// UserBase provides message sending
type UserBase struct {
ID UserID
// Framework things
pump *MessagePump
}
// NewUserBase return a new UserBase
func NewUserBase(pump *MessagePump) *UserBase {
return &UserBase{
pump: pump,
}
}
// SendMessage sends the given message, including type, over the wire
func (base *UserBase) SendMessage(messageType MessageType, pb proto.Message) error {
return base.pump.SendMessage(messageType, pb)
}
// Base return UserBase
func (base *UserBase) Base() *UserBase {
return base
}
// Disconnect disconnects the user from the server
func (base *UserBase) Disconnect() {
base.pump.Disconnect()
}