ICommand增加配置方法,支持覆盖全局配置

This commit is contained in:
2021-04-17 15:04:43 +08:00
parent 18e1719e86
commit c26624befb
5 changed files with 97 additions and 3 deletions

View File

@ -10,6 +10,8 @@ package main
import (
"fmt"
"github.com/go-developer/websocket/config"
"github.com/go-developer/websocket/message"
"github.com/go-developer/websocket"
@ -64,6 +66,10 @@ func (e exampleCommand) GetCommand() string {
return "ping"
}
func (e exampleCommand) GetConfigOption() []config.SetCommandConfig {
return []config.SetCommandConfig{config.ClosePushCommandErrorMessage()}
}
func (e exampleCommand) Execute(ctx *context.WSContext, data []byte) error {
message.Response(ctx, map[string]interface{}{"ping": "pong"})
return nil