Documentation ¶
Overview ¶
* websocket客户端
Index ¶
- Constants
- Variables
- func SendMessage()
- type ChatPlugin
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (m *Message) GetMessage() string
- func (m *Message) GetMessageColor() string
- func (m *Message) GetPlayer() string
- func (m *Message) GetPlayerColor() string
- func (m *Message) GetServerName() string
- func (m *Message) GetServerNameColor() string
- func (m *Message) GetState() int64
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) String() string
- func (m *Message) XXX_DiscardUnknown()
- func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Message) XXX_Merge(src proto.Message)
- func (m *Message) XXX_Size() int
- func (m *Message) XXX_Unmarshal(b []byte) error
- type WSClient
- type WSServer
- type WSServerClient
- type WebSocketRS
Constants ¶
View Source
const ChanMaxSize int = 20
View Source
const Default_Message_MessageColor string = "white"
View Source
const Default_Message_PlayerColor string = "white"
View Source
const Default_Message_ServerNameColor string = "white"
View Source
const LocalServerId int = -1
View Source
const MinecraftServerId int = -2
Variables ¶
View Source
var ( WSsvr *WSServer WSrsPool []WebSocketRS LocalServerName string IsStart bool FirstTouch int64 = 1024 NotInWhitelist int64 = 1 ContainerName string )
Functions ¶
Types ¶
type ChatPlugin ¶
type ChatPlugin struct{}
func (*ChatPlugin) Close ¶
func (Cp *ChatPlugin) Close()
func (*ChatPlugin) Init ¶
func (Cp *ChatPlugin) Init(s lib.Server)
type Message ¶
type Message struct { ServerName *string `protobuf:"bytes,1,req,name=ServerName" json:"ServerName,omitempty"` Player *string `protobuf:"bytes,2,opt,name=Player" json:"Player,omitempty"` Message *string `protobuf:"bytes,3,opt,name=Message" json:"Message,omitempty"` ServerNameColor *string `protobuf:"bytes,4,opt,name=ServerNameColor,def=white" json:"ServerNameColor,omitempty"` PlayerColor *string `protobuf:"bytes,5,opt,name=PlayerColor,def=white" json:"PlayerColor,omitempty"` MessageColor *string `protobuf:"bytes,6,opt,name=MessageColor,def=white" json:"MessageColor,omitempty"` State *int64 `protobuf:"varint,7,opt,name=state" json:"state,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Message) Descriptor ¶
func (*Message) GetMessage ¶
func (*Message) GetMessageColor ¶
func (*Message) GetPlayerColor ¶
func (*Message) GetServerName ¶
func (*Message) GetServerNameColor ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) XXX_DiscardUnknown ¶
func (m *Message) XXX_DiscardUnknown()
func (*Message) XXX_Marshal ¶
func (*Message) XXX_Unmarshal ¶
type WSClient ¶
type WSServer ¶
type WSServer struct { ServerId int //服务器id ServerName string //服务器名称 Port int Suburl string //子路由 ReceiveMessage chan *msgPackage //接受到的消息 SendMessage chan *Message //要发送的消息 ConnPool map[string]*WSServerClient //连接池,键为服务器名称,值为封装的websocket连接对象 RWPool *sync.RWMutex //连接池读写锁 WhiteList map[string]interface{} //白名单 Ctx context.Context //上下文 Cancel context.CancelFunc Alive bool //是否是活跃连接 // contains filtered or unexported fields }
type WSServerClient ¶
Click to show internal directories.
Click to hide internal directories.