I am trying to work with client.py , server.cpp and a make file. I am not understanding how to run the files and work on grpc with these files. Is it possible for anyone to help me understand this concept and work with the client, server and protobuf?
The whole idea of gRPC is to enable protocol based communication between cross platform services. Means your CPP server can communicate with python client. Ref: Official gRPC Documentation
First step is to write a .proto file which is an agreement between server and client on what attributes should a request / response for a particular RPC method should contain.
Now one can implement server, client in any language of their choice. As long as server & client agree on single proto file, underlying process is abstracted by gRPC framework and it just works!!!
For fastest hands-on, Refer to quick start guides of gRPC for c++, python to implement cross platform server, client.
Related
From official website Go gRPC, we can generate gRPC code using protoc with a .proto file. And then we can setup server and send gRPC request.
But now I want to send gRPC request to an any gRPC server with a specified '.proto' file. So I should parse the .proto file and then send gRPC request to that gRPC server.
Could any one know how to realize it?
Thank you very much!
You probably want to generate a client anyways. The beauty of grpc is static typing. I found this library, not sure if it is what you are looking for. I don't think that go supports dynamic libraries yet here, so I'm not sure how easy this is to implement.
I have a grpc service that contains several apis(getName, getInfo, etc), and a grpc endpoint, something like this,
configuration-dev-grpc.kmc-default.us-west-2**.com:443
I create a graphql project, how can I connect the graplql with grpc service through that endpoint, or I need to do it in another way?
gRPC and GraphQL are often considered alternatives but, if we consider gRPC as just procedure calls, there's no reason why a GraphQL server could not be implemented against a gRPC client to serve GraphQL clients.
At least one group has a solution:
https://github.com/ysugimoto/grpc-graphql-gateway
If you control the gRPC server, it would possibly be preferable to implement the GraphQL server alongside it, i.e. directly against whatever API it provides. Doing this would avoid the networking between gRPC client and server and the Protobuf (un)marshaling.
I'm trying to analyse what information an app is sending so I setup Charles but to my surprise nothing was logged out.
After decompiling the app I see that it doesn't use simple REST calls but rather a library called gRPC.
Is there a good tool out there that will allow me too see what is send out from the app?
The Mediator is a Cross-platform GUI gRPC debugging proxy like Charles but design for gRPC.
You can dump all gRPC requests without any configuration.
Mediator can render the binary message into a JSON tree, when you have the API schema.
It support decode gRPC/TLS, but you should download and install the Mediator Root Certificate to your device.
gRPC uses HTTP/2 as a transport protocol. Any proxy which supports HTTP/2 for both the front-end and back-end connections should be able to be used to inspect the packets a gRPC connection. Note, some proxies only support HTTP/2 for the front-end or back-end connections and those are incompatible with gRPC.
Envoy Proxy (https://www.envoyproxy.io/) supports proxying gRPC connections and can be configured to log out request information.
Some other example proxies include:
Nginx https://medium.com/nirman-tech-blog/nginx-as-reverse-proxy-with-grpc-820d35642bff
https://github.com/mwitkow/grpc-proxy
https://github.com/mercari/grpc-http-proxy
If you are asking for android there is a app called HttpCanry. It can log request/ respond.
I would like to use thrift with a Java server sending data to a browser using websockets. Is this possible?
According to this issue: https://issues.apache.org/jira/browse/THRIFT-2355 Thrift recieved support for web sockets in the javascript compiler for version 0.9.2.
In thrift there are 2 important things: protocol, and transport. Protocol defines how is data serialized into the data stream. And transport defines how are those streams of data exchanged between communicating entites.
There is json protocol in thrift which is supported by javascript, but as far as transports go I think Thrift supports only 2 transports raw tcp, and http. Later can be used to invoke operation on a HTTP server, and fetch the result from it, but not the other way around as you need it.
I guess you might be able to use json protocol, but you would need to roll your sleeves up and implement your own websockets transport. This could be a a non trivial task.
As of v.0.9.0 of Thrift, the answer is no.
On the client side, the javascript generated uses AJAX for it's transport as seen in Thirft.js library, so if a client was to use a WebSocket, then transport in Thrift needs modified.
On the server side, the Java code shows a socket server, but I believe it doesn't have the handshaking needed for the WebSocket server side code. Again, probably be added somewhat easily. It probably makes more sense for you to use jWebSocket as your server and the Java object classes created by thrift than the Thrift version of the server. You can inspect the code to know it better in Thrift. see /lib/java/src/org/apache/thrift/ section of the trunk in Thrift.
I want to create a messaging service that uses the XMPP protocol. How would I implement the server-side as well as the client side aspects of this service? I know I would need a server (like Jabberd 2) that runs the messaging framework. How hard would this be to set up and get running? Also what would be the best way to hook up a client program into this service? How would i start pushing messages from one client, through the server, to another client?
Server: there are many out there, see http://xmpp.org/software/servers.shtml for a list.
I've used OpenFire in the past, it's fairly straightforward to set up.
You can add a library like xmppframework to your Cocoa project to make it a client, and configure it to talk to your XMPP server.
Each client gets an identifier (called a 'jid') of the form: uniquetext#xmppserver.name, and you send messages from one client to the other by addressing them to the jid of the intended recipient.
If you want to play around with simple examples in a scripting language, you can use something like the examples in the python xmpp library to see how it all works. Use an xmpp client like psi to connect as one jid and use the examples to connect as another jid to send/receive messages through the server.