# grpcurl -plaintext localhost:50051 list demo.Demo
demo.Demo.Chat
demo.Demo.Connect
demo.Demo.GetServerStats
demo.Demo.SayHello
demo.Demo.UploadData
# grpcurl -plaintext localhost:50051 list demo.User
demo.User.GetUserUpdatesV1
demo.User.GetUserUpdatesV2
demo.User.LoginV1
demo.User.LoginV2
demo.User.RegisterV1
demo.User.RegisterV2
简单的问候服务,返回服务器信息。
# 使用grpcurl测试
grpcurl -plaintext -d '{"name": "test"}' localhost:50051 demo.HelloWorld/SayHello
# 或
docker run --name client -it --rm --network host vvoo/demoapp-grpc:client ./demoapp_client hello
建立长连接,服务器持续向客户端推送消息。
# 使用grpcurl测试
grpcurl -plaintext -d '{"client_id": "test-client"}' localhost:50051 demo.HelloWorld/Connect
# 或
docker run --name client -it --rm --network host vvoo/demoapp-grpc:client ./demoapp_client connect
客户端向服务器上传数据流。
# 使用客户端程序测试,因为grpcurl不支持流式上传
docker run --name client -it --rm --network host vvoo/demoapp-grpc:client ./demoapp_client upload
实时聊天功能,支持多客户端之间的消息广播。
# 使用客户端程序测试
docker run --name client -it --rm --network host vvoo/demoapp-grpc:client ./demoapp_client chat
获取服务器统计信息。
# 使用grpcurl测试
grpcurl -plaintext -d '{"client_id": "test-client"}' localhost:50051 demo.HelloWorld/GetServerStats
# 或
docker run --name client -it --rm --network host vvoo/demoapp-grpc:client ./demoapp_client stats
基础用户注册功能。
# 使用grpcurl测试
grpcurl -plaintext -d '{"username": "test", "password": "123456", "email": "[email protected]"}' localhost:50051 demo.User/RegisterV1
增强版用户注册功能,支持更多用户信息。
# 使用grpcurl测试
grpcurl -plaintext -d '{
"username": "test",
"password": "123456",
"email": "[email protected]",
"phone": "13800138000",
"nickname": "测试用户",
"metadata": {
"age": "25",
"location": "Beijing"
}
}' localhost:50051 demo.User/RegisterV2
基础用户登录功能。
# 使用grpcurl测试
grpcurl -plaintext -d '{"username": "test", "password": "123456"}' localhost:50051 demo.User/LoginV1
增强版用户登录功能,支持多种登录方式。
# 使用用户名登录
grpcurl -plaintext -d '{
"login_type": "USERNAME",
"identifier": "test",
"credential": "123456"
}' localhost:50051 demo.User/LoginV2
# 使用邮箱登录
grpcurl -plaintext -d '{
"login_type": "EMAIL",
"identifier": "[email protected]",
"credential": "123456"
}' localhost:50051 demo.User/LoginV2
# 使用手机号登录
grpcurl -plaintext -d '{
"login_type": "PHONE",
"identifier": "13800138000",
"credential": "123456"
}' localhost:50051 demo.User/LoginV2
获取基础版用户状态更新流。
# 使用客户端程序测试
go run client/main.go user
获取增强版用户状态更新流,包含更多实时信息。
# 使用客户端程序测试
go run client/main.go user
Content type
Image
Digest
sha256:0cb19df4a…
Size
10.7 MB
Last updated
over 1 year ago
docker pull vvoo/demoapp-grpc:client