```
fix(network): 修复 rpc 和 websocket 地址拼接缺少冒号的问题 修复了 jsonrpc 服务启动时监听地址缺少冒号导致解析错误的问题, 同时修正 websocket 客户端连接地址的拼接逻辑。此外,注释掉了一处日志输出, 并调整了端口检测函数的参数类型以匹配实际配置结构。 ```
This commit is contained in:
@@ -68,12 +68,12 @@ func StartServer() {
|
||||
rpcServer := jsonrpc.NewServer(jsonrpc.WithReverseClient[ClientHandler](""))
|
||||
|
||||
rpcServer.Register("", &ServerHandler{})
|
||||
cool.Loger.Debug(context.Background(), "jsonrpc server start")
|
||||
cool.Loger.Debug(context.Background(), "jsonrpc server start", rpcport)
|
||||
// go time.AfterFunc(3000, func() {
|
||||
// testjsonrpc()
|
||||
// })
|
||||
|
||||
err := http.ListenAndServe("0.0.0.0"+rpcport, rpcServer)
|
||||
err := http.ListenAndServe("0.0.0.0:"+rpcport, rpcServer)
|
||||
cool.Loger.Debug(context.Background(), "jsonrpc server fail", err)
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ func StartClient(id, port uint16, callback any) *struct {
|
||||
var rpcaddr, _ = service.NewBaseSysParamService().DataByKey(context.Background(), "server_ip")
|
||||
|
||||
closer1, err := jsonrpc.NewMergeClient(context.Background(),
|
||||
"ws://"+rpcaddr+rpcport, "", []interface{}{
|
||||
"ws://"+rpcaddr+":"+rpcport, "", []interface{}{
|
||||
&RPCClient,
|
||||
}, nil, jsonrpc.WithClientHandler("", callback),
|
||||
jsonrpc.WithReconnFun(func() { RPCClient.RegisterLogic(id, port) }),
|
||||
|
||||
Reference in New Issue
Block a user