Esp-idf: GRPC Example? (IDFGH-1026)

Created on 23 Apr 2019  路  13Comments  路  Source: espressif/esp-idf

This isn't an issue, but more of a feature request I suppose. This has been asked in the forum, but the thread hasn't had a reply since February...

here

So it looks like the ESP Voice Assistant SDK uses Google Dialogflow through the gRPC hooks. Is there any way we could get a generic example of using gRPC in the IDF? Or maybe someone out there has some code they'd like to share where they've implemented gRPC on the ESP32?

Most helpful comment

That would be great! In the meantime I'll keep trying to figure it out.

All 13 comments

Hi @eagi223 We will add this to the to-do list. Although, for now, I do not have concrete timelines for that.

That would be great! In the meantime I'll keep trying to figure it out.

I'm interested in the gRPC example on ESP32 too.

I checked the esp-va-sdk repo but was not able to find anything. The code appears to be inside of the libdialogflow.a library.

By the way, there are people interested in this topic since 2016:

https://twitter.com/proppy/status/800767976244854784

Could you inform if you are using Juniper/grpc-c or just sending the raw protocol buffer packets via HTTP2 ?

Are you using sh2lib for that?

hi, @eagi223 @dhrishi @kroggen someone have news about grpc in ESP device . ?

i am interested too .. any news or solutions ?

I did it manually encoding and decoding the protocol-buffers packets using nanopb and sending them using sh2lib.

I cannot share the code now but you can check these tutorials:

https://techtutorialsx.com/2018/10/19/esp32-esp8266-arduino-protocol-buffers/

https://techtutorialsx.com/2019/01/04/esp32-http-2-post-request-with-headers/

@kroggen , Thanks very much for your quick reply, i have run encoding code in esp32 using first tutorial , but i dont know more about deconding data from my server (visual studio c#).

and what u thing about PJON-GRPC : https://github.com/Halytskyi/PJON-gRPC ??

This PJON is new to me. I never used it.

But if you have control over the server, why not just use a simple JSON or Binn and simple HTTP?

I had to use GRPC simply because the server already exists and the only option was to comply with it.

Protocol-buffers in C sucks!

@kroggen i dont know if i can use it and i want to HTTPS i hope that not a problem ?

@kroggen

Is there any updates about gRPC ??!

Hi,

I don't know any easy solution to use GRPC on ESP32, but I can share what I did.

I separated the process in 2 parts:

  1. Encoding and decoding the messages using nanopb (check the examples above)
  2. Calling the service function via HTTP2 using sh2lib and sending the encoded message as payload (and decoding the received message)

Just the protobuf encoded message is not sufficient as payload, we need to add 5 bytes before to comply with the HTTP2 spec. The first byte must be zero (meaning no compression) and the remaining 4 bytes are the size of the message in big endian.

I just released the project that uses this method. You can check the sources here

You can start by the send_grpc_request function

Hm. Any Updates on this ? - We wan't to start a bigger Project with Ethernet, gRPC and CAN on ESP32, but gRPC is neccesary for this :-/

Was this page helpful?
0 / 5 - 0 ratings

Related issues

feelfreelinux picture feelfreelinux  路  4Comments

waayst picture waayst  路  4Comments

KaeLL picture KaeLL  路  3Comments

jakkubu picture jakkubu  路  4Comments

kylefelipe picture kylefelipe  路  3Comments