diff --git a/cmd/rpc/open_im_rtc/main.go b/cmd/rpc/open_im_rtc/main.go new file mode 100644 index 000000000..e093a361f --- /dev/null +++ b/cmd/rpc/open_im_rtc/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "Open_IM/internal/rpc/rtc" + "Open_IM/pkg/common/log" + rtcPb "Open_IM/pkg/proto/rtc" + "Open_IM/pkg/utils" + "google.golang.org/grpc" + "google.golang.org/grpc/reflection" + "net" +) + +func main() { + lis, err := net.Listen("tcp", "0.0.0.0:11300") + if err != nil { + log.NewError("", utils.GetSelfFuncName(), err.Error()) + } // 创建 RPC 服务容器 + grpcServer := grpc.NewServer() + rtcPb.RegisterRtcServiceServer(grpcServer, &rtc.RtcService{}) + + reflection.Register(grpcServer) + + if err := grpcServer.Serve(lis); err != nil { + log.NewError("", utils.GetSelfFuncName(), err.Error()) + } + log.NewInfo("", utils.GetSelfFuncName(), "start success") +} \ No newline at end of file diff --git a/go.mod b/go.mod index 327aec7cf..7973c238a 100644 --- a/go.mod +++ b/go.mod @@ -32,6 +32,7 @@ require ( github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible github.com/lestrrat-go/strftime v1.0.4 // indirect github.com/lib/pq v1.2.0 // indirect + github.com/livekit/protocol v0.11.14-0.20220223195254-d8c251e13231 // indirect github.com/livekit/server-sdk-go v0.9.1 github.com/mattn/go-sqlite3 v1.14.6 // indirect github.com/minio/minio-go/v7 v7.0.22