增加基础的连接管理与command调度
This commit is contained in:
@ -46,7 +46,7 @@ func (e Example) HandshakeURL() []string {
|
||||
}
|
||||
|
||||
func (e Example) GetCommandList() []abstract.ICommand {
|
||||
return nil
|
||||
return []abstract.ICommand{&exampleCommand{}}
|
||||
}
|
||||
|
||||
func (e Example) GetModuleFlag() string {
|
||||
@ -56,3 +56,15 @@ func (e Example) GetModuleFlag() string {
|
||||
func (e Example) GetServerPort() int {
|
||||
return 10099
|
||||
}
|
||||
|
||||
type exampleCommand struct {
|
||||
}
|
||||
|
||||
func (e exampleCommand) GetCommand() string {
|
||||
return "ping"
|
||||
}
|
||||
|
||||
func (e exampleCommand) Execute(ctx *context.WSContext, data []byte) error {
|
||||
message.Response(ctx, map[string]interface{}{"ping": "pong"})
|
||||
return nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user