protobuf-net / protobuf-net.Grpc

GRPC bindings for protobuf-net and grpc-dotnet
Other
867 stars 114 forks source link

Broadcast support #279

Open bdovaz opened 1 year ago

bdovaz commented 1 year ago

Hi @mgravell,

Although this post would make more sense in discussions, I see that this repository does not have it enabled and that is why I have no choice but to create an issue even though it really is not.

Because of the particularities of Unity and that it has its own compilation pipeline and does not use msbuild, I cannot use the NuGet package of Grpc.Tools to convert the .proto files to code.

That is why I have seen that a code-first approach is used is this repository without .proto files.

In the following repository, there is an example of how to make an example of a chat, so a subscription and broadcasting pattern is used: https://github.com/chgc/grpc-dotnetcore-3-chat

The problem is that it does not use protobuf-net so I am trying to figure out how to port that same example to protobuf-net.Grpc.

Can you guide me through the process with resources that can help me? The code in that repository is very little but I don't know what the equivalencies are to do the same thing.

I have been looking in the examples folder but have not seen anything similar.

Thanks!

mgravell commented 1 year ago

Firstly, note that even for the Google version, protoc can be used in isolation outside of Grpc.Tools, if you need the code-gen separate. Protobuf-net has similar tools, and indeed you can use https://protogen.marcgravell.com/ as a lazy way of getting this output from the existing .proto in that repo (including via "protoc" and protobuf-net style).

General getting started guidance is here: https://protobuf-net.github.io/protobuf-net.Grpc/gettingstarted.html

However, note that protobuf-net and protobuf-net.Grpc are currently reflection (and ref-emit) oriented. I have plans to support better AOT, but this is t my day job, and it is not yet complete. I cannot say how well it works with unity, as I'm not a unity person.