优化 Websocket 连接

This commit is contained in:
奶爸
2019-12-10 18:05:02 +08:00
parent 3c39e1537d
commit 7b5aae3e67
5 changed files with 9 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package rpc
import (
"fmt"
"net"
"google.golang.org/grpc"
@@ -10,12 +11,12 @@ import (
)
// ServeRPC ...
func ServeRPC() {
func ServeRPC(port uint) {
server := grpc.NewServer()
pb.RegisterNezhaServiceServer(server, &rpcService.NezhaHandler{
Auth: &rpcService.AuthHandler{},
})
listen, err := net.Listen("tcp", ":5555")
listen, err := net.Listen("tcp", fmt.Sprintf(":%d", port))
if err != nil {
panic(err)
}