1 Star 0 Fork 0

ryancartoon/sensu-go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
server.go 639 Bytes
一键复制 编辑 原始数据 按行查看 历史
package transport
import (
"net/http"
"github.com/gorilla/websocket"
)
// Server ...
type Server struct {
upgrader *websocket.Upgrader
}
// NewServer is used to initialize a new Server and return a pointer to it.
func NewServer() *Server {
return &Server{
upgrader: &websocket.Upgrader{},
}
}
// Serve is used to initialize a websocket connection and returns an pointer to
// a Transport used to communicate with that client.
func (s *Server) Serve(w http.ResponseWriter, r *http.Request) (Transport, error) {
conn, err := s.upgrader.Upgrade(w, r, nil)
if err != nil {
return nil, err
}
return NewTransport(conn), err
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ryancartoon/sensu-go.git
git@gitee.com:ryancartoon/sensu-go.git
ryancartoon
sensu-go
sensu-go
v5.10.1

搜索帮助