grpc/grpc-swift

Connection with Nest Server

abdelazizSalah opened this issue · 8 comments

Nest Server Connection

  • I am facing a problem, as I am working on my graduation project, and we want to connect swift with the server using the gRPC communication protocol.
  • I have generated the .pb and .grpc files successfully, however, in the .pb file, it gives me an error for using proto version 3.
image * When I comment these lines it works, and I have implemented a small javascript file, and calculator swift client, and they work well together, here are some snippets for the client code * image image image

and here are some snippets for the javascript server:
image
image
image

What are you trying to achieve?

  • I want to do the same job but with nest instead of javascript.
  • however, when I connect on the same port, with the same proto files exactly, I don't get any output, and It sounds like there is no connection between the server and the client.
  • Here are some snippets from the nest server
image image image image

Describe your problem at a high level. Include code snippets if you think that
would help better illustrate your problem. Without enough information, we will
not be able to help you.

What have you tried so far?

  • I have tried many things, trying to check on the connectivity of the port, and I have reached that I can use the .delegate property to check on the status of the channel, and it gives me that
image
  • The connection is ready, however, the server does not print any thing.
  • also I have made a busy wait while loop to check on the time needed for the channel to change its status from idle to ready, and it takes almost 0.016 seconds for that.
  • and I tried to use wrong ports and hosts, but when I do this the channel never becomes ready.
  • So now I am looking for help in this issue as it is very critical for me to finish this connection to continue in my graduation project.
  • and this is my email, if anyone is free to go for an online meet to solve this issue.
  • abdelaziz132001@gmail.com

Describe what you've tried to do so far to solve your problem. Include any
relevant information such as the library and protoc plugin versions,
the full protoc invocation (if the problem is related to code generation),
and any logs or error messages.

image

How did you generate these files? What version of protoc-gen-swift did you use?

for some reasons, the image you have attached is not displayed well, however, I have installed the latest version
image
I have cloned the repo, then I have followed the instructions, and whenever I need to convert the proto file to .pb and .grpc, I use this command:
protoc --swift_out=. --grpc-swift_out=. proto_file_name.proto
image

What's the output of protoc-gen-swift --version?

protoc-gen-swift 2.0.0

That might be your problem; Swift Protobuf doesn't have a 2.x version yet, so I assume you built that from main.

Can you build a 1.x version of protoc-gen-swift and see if that fixes your issues?

should I run this command?
image
or what should I do to change the version?

You can run that command from the root of the grpc-swift repository.

protoc-gen-swift will then be in /path/to/grpc-swift/.build/release/.

protoc will look for protoc-gen-swift in your $PATH, so either you need to add the version of protoc-gen-swift you built to your $PATH or you can specify it directly to protoc using --plugin=/path/to/protoc-gen-swift.

Thank you so much!