Ai
1 Star 0 Fork 0

bluesky2006/wserver

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
main.go 503 Bytes
一键复制 编辑 原始数据 按行查看 历史
alfredZhong 提交于 2018-03-29 16:29 +08:00 . modify example
package main
import (
"bytes"
"encoding/json"
"fmt"
"net/http"
"time"
"github.com/alfred-zhong/wserver"
)
func main() {
pushURL := "http://127.0.0.1:12345/push"
contentType := "application/json"
for {
pm := wserver.PushMessage{
UserID: "jack",
Event: "topic1",
Message: fmt.Sprintf("Hello in %s", time.Now().Format("2006-01-02 15:04:05.000")),
}
b, _ := json.Marshal(pm)
http.DefaultClient.Post(pushURL, contentType, bytes.NewReader(b))
time.Sleep(time.Second)
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/bluesky2006/wserver.git
git@gitee.com:bluesky2006/wserver.git
bluesky2006
wserver
wserver
v1.1.0

搜索帮助