From 9a9365bab1ac354b109ad5b5feb5ae3d370e0e3f Mon Sep 17 00:00:00 2001 From: chenjunbiao Date: Thu, 26 Nov 2020 17:51:58 +0800 Subject: [PATCH] update echoServerAddr to codec server and echo sample (#49) --- README.md | 7 ++++--- README_CN.md | 5 +++-- configs/echo.go | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index ce7b7879e..dfcc01fbe 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,8 @@ func main() { // automatically connect to the development server of yomo.run // after successfully connected to the server, the plugin will receive the value // of the key specified by the Observed() method every 2 seconds - yomo.RunDev(&EchoPlugin{}, "localhost:4241") + // yomo.RunDev(&EchoPlugin{}, "localhost:4241") + yomo.RunDevWith(&EchoPlugin{}, endpoint, yomo.OutputEchoData) } // EchoPlugin - a yomo plugin that converts received data into strings and appends @@ -58,7 +59,7 @@ func (p *EchoPlugin) Handle(value interface{}) (interface{}, error) { // Observed - returns a value of type string, which is the key monitored by echo plugin; // the corresponding value will be passed into the Handle() method as an object func (p EchoPlugin) Observed() string { - return "name" + return "0x11" //name } // Name - sets the name of a given plugin p (mainly used for debugging) @@ -77,7 +78,7 @@ func (p EchoPlugin) Mold() interface{} { 1. Run `go run echo.go` from the terminal. If YoMo is installed successfully, you will see the following message: ```bash -% go run a.go +% go run echo.go [EchoPlugin:6031]2020/07/06 22:14:20 plugin service start... [localhost:4241] name:yomo!✅ name:yomo!✅ diff --git a/README_CN.md b/README_CN.md index da5c3117c..da310a6ec 100644 --- a/README_CN.md +++ b/README_CN.md @@ -169,7 +169,8 @@ func main() { // 开发调试时运行该方法,处于联网状态时,程序会自动连接至 yomo.run 的开发服务器,连接成功后, // 该Plugin会每2秒收到一条Observed()方法指定的Key的Value - yomo.RunDev(&EchoPlugin{}, "localhost:4241") + // yomo.RunDev(&EchoPlugin{}, "localhost:4241") + yomo.RunDevWith(&EchoPlugin{}, endpoint, yomo.OutputEchoData) } // EchoPlugin 是一个YoMo Plugin,会将接受到的数据转换成String形式,并再结尾添加内容,修改 @@ -185,7 +186,7 @@ func (p *EchoPlugin) Handle(value interface{}) (interface{}, error) { // Observed 返回一个string类型的值,该值是EchoPlugin插件关注的数据流中的Key,该数据流中Key对应 // 的Value将会以对象的形式被传递进Handle()方法中 func (p EchoPlugin) Observed() string { - return "name" + return "0x11" //name } // Name 用于设置该Plugin的名称,方便Debug等操作 diff --git a/configs/echo.go b/configs/echo.go index 07f9bdc73..59789db57 100644 --- a/configs/echo.go +++ b/configs/echo.go @@ -20,6 +20,6 @@ const ( func GetEchoConf() EchoConf { conf := EchoConf{} - conf.EchoServerAddr = env.GetString(echoServerAddr, "161.189.140.133:11520") + conf.EchoServerAddr = env.GetString(echoServerAddr, "161.189.140.133:11521") return conf }