增加基础的连接管理与command调度

This commit is contained in:
2021-04-09 16:08:00 +08:00
parent 87f0a26e5e
commit d21d9c1395
6 changed files with 53 additions and 21 deletions

View File

@ -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
}