Vincent Parrett 849 Posted December 8, 2023 Can anyone recommend a GRPC client library for delphi. I have had a quick look around and only found a 1 open source lib - https://github.com/ultraware/DelphiGrpc (no updates in 5 yrs), and nsoftware (which I will not buy as no source available). Any others I have missed (open source or commercial with source code). Share this post Link to post
Darian Miller 387 Posted December 8, 2023 Not much info but FWIW, here's someone attempting it using Grijjy (https://github.com/grijjy/DelphiScalableClientSockets) https://stackoverflow.com/questions/53977759/google-speech-api-grpc-sync-request-processes-first-words-only Share this post Link to post
Vincent Parrett 849 Posted December 8, 2023 1 hour ago, Darian Miller said: Not much info but FWIW, here's someone attempting it using Grijjy (https://github.com/grijjy/DelphiScalableClientSockets) https://stackoverflow.com/questions/53977759/google-speech-api-grpc-sync-request-processes-first-words-only I've been looking at that - since the DelphiGRPC makes use of it. Down the rabbit hole I go.. 1 Share this post Link to post
Kas Ob. 147 Posted December 8, 2023 3 hours ago, Vincent Parrett said: 4 hours ago, Darian Miller said: Not much info but FWIW, here's someone attempting it using Grijjy (https://github.com/grijjy/DelphiScalableClientSockets) https://stackoverflow.com/questions/53977759/google-speech-api-grpc-sync-request-processes-first-words-only I've been looking at that - since the DelphiGRPC makes use of it. Down the rabbit hole I go.. Well, i see sgcWebSockets folder there, this means the porting to sgcWebSockets is possible if not easy (or already there), DTLS with 1(or 0) handshake round-trip (with TLS1.3) and HTTP/2 are available, this will should get your attention, for performance and bandwidth utilization. Share this post Link to post
Vincent Parrett 849 Posted December 8, 2023 I looked at sgcWebSockets today - but the price is really steep - I don't need the rest of the library but http/2 is only in the most expensive version - and then I need to get gprc working on top of that. I'm actually leaning towards doing this project in c# (the server is already c#) - testing with .net 8.0 AOT compilation so far produced a 4.5MB exe (+ a 12MB dll for google protocol buffers). Obviously it will be larger than that once done. As much as I want to use delphi for this project - the libraries are just not there - contrast to dotnet - grpc is a first class citizen (and the performance is impressive). I was able to get up and running in less than 10 minutes - contrast that to having spent most of today looking for a delphi grpc client that works. 3 Share this post Link to post
JackT 0 Posted Wednesday at 11:07 AM Did you ever get GRCP working with the sgc libraries. I tried to do a grpc call with TsgHTTP2Client which is partially successful in that it calls the server but I got an error in the response //NON WORKING INCOMPLETE CODE FOR ILLUSTRATION PURPOSE ONLY type TGRPCFrameHeader = packed record B1:Byte; Size:Cardinal; end; var FH:TGRPCFrameHeader; httP:=TsgcHTTP2Client.Create(nil); http.request.TransferEncoding:='grpc-encoding'; http.request.AcceptEncoding :='grpc-accept-encoding'; http.request.AcceptEncoding :=''; http.request.ContentType:='application/grpc+proto'; http.ConnectTimeout:=10000; http.ReadTimeout:=10000; http.WriteTimeout:=10000; //http.request.CustomHeaders.AddPair('grpc-encoding','gzip'); http.request.CustomHeaders.AddPair('TE','trailers'); //Write header FH.B1 :=0; FH.Size := Length(BA); //Prepare byte array BA write 5 byte header then write message data outstream.write(FH,SizeOf(FH)); outstream.Write(BA,Length(BA)); http.post('http://127.0.0.1:50051/helloworld.Greeter/SayHello',outstream,memstream); Finally I try to call the HelloWorld c plus plus server example in GRPC examples from git hub where BA = When I do the call I get a list of strings back in http.reponse.headers one of which is grpc-message=Couldn't initialize byte buffer reader Process myGRPC.exe (21704) I suspect my http2 headers are wrong. I have to say GRPC is one of the worst things I have ever come across to try to work with. I have managed to make a rudimentary framework which can read most proto files and to create a structures so that data can be stored against proto file data members in the correct format. However I can not figure out how to make GRPC call over HTTP2. I don't know if I have to set some header flags Share this post Link to post
Vincent Parrett 849 Posted Wednesday at 12:56 PM I ended up using c# for the project - https://www.finalbuilder.com/signotaur - delphi just lacked the technologies I wanted to use for the project and I didn't want to spend so much time just getting the plumbing working. 1 Share this post Link to post
JackT 0 Posted Wednesday at 01:55 PM (edited) I am trying to link to an instrument that another company has made that uses GRPC to send data back to a controlling computer. I have managed to do this in C# but it has been a nightmare in C++ Builder and Delphi. GRPC is supposed to be 10 years old now but so you would have thought it would be fairly stable at this point. However if you go on the news group https://groups.google.com/g/grpc-io you can see that this trouble shooting group is very active with daily posts from people having problems with it. I guess GRPC was designed for interoperability between microservices in data centres where you have a lot of coders working on a distributed architecture on many machines. The fact that GRPC has to author it's own code from proto files for each implementation makes it very hard for 3rd party providers to keep up. In my opinion GRPC is a bad technology in that it promises ease of interoperability, but delivers complexity, bloat and obfuscation by the truck load. It's also a poorly documented project with out of date help files and examples that no longer work. However if I can get things working natively in Delphi it will be a real triumph. Edited Wednesday at 04:36 PM by JackT Share this post Link to post