SignalR with msgpack hub protocol - signalr

I used Flutter, SignalR to build a chat application.
I connected to socket server according to msgpack hub protocol. Unfortunately, the result that I get when using msgpack and json hub protocol is different.
I don't know my problem is in client or server connection library.
How to test msgpack hub protocol with postman or
something similar

Related

How can I make server query some data from client via grpc?

I am using grpc for client/server communication since it supports bidirectional streaming. I have read some doc relates to that: https://grpc.io/docs/what-is-grpc/introduction/
It supports:
A simple RPC where the client request to server to receive a response
A server-side streaming RPC where the client sends a request to the server and gets a stream to read a sequence of messages back.
A client-side streaming RPC where the client writes a sequence of messages and sends them to the server, again using a provided stream
I have a case that to let server to send a query request to client to receive a response. The bi-directional is only used in streaming case not request-response case.
I couldn't find any way to support that pattern. Is this supported by grpc?
The initiator of a request is by definition the client.
To address your need:
the code currently functioning only as a gRPC server must also implement a gRPC client; and
the code currently functioning only as a gRPC client must also implement a gRPC server.

Mixing websockets and http

When speaking from a conceptual point of view, is it standard practice to mix WebSockets and HTTP requests when making a chat application (or any application that requires real-time communication between devices)?
Imagine a scenario with a client and a server in a chat app. What would be the best approach for connecting and sending data between the client and the server? Would it be using sockets for both sending and receiving or HTTP requests for sending (so the client would get a response and then know if the message was received), and then using WebSocket for only receiving new messages?
No this is not standard practice.
If you need real-time communication between client and server you normally just use a websocket connection and keep that one open. The client can send messages to the server and receive messages through the same connection.
Using HTTP requests for sending messages to the server and receiving new messages via websocket seems odd and just adds unnecessary complexity.
Now if your server has some endpoints to subscribe for real-time data e.g. a chat room and endpoints for getting information you don't necessary want to subscribe to e.g. information about a certain user, than you can use the appropriate protocol for each endpoint

Grpc-Web Client in Java

I'm trying to connect to a grpc-service from a Java client. The problem is that this service is currently supporting only grpc-web over http1.1, this is because of a limitation of supporting http2 in Azure App service where the service is deployed.
The grpc-java client liberary from io.grpc only supports grpc over http2 protocol, which maskes sense, and unfortenatly is not working for me.
I managed to consume a service using HTTP client from apache and okhttp3 but this works for unary calls and it didn't work for a server-side streaming service.
Is any one aware of a grpc-web java client liberary that I could use or a work arround using convenienal Http for reading grpc-web server-side streaming service.
If I understand your question correctly, you want a Java client for gRPC-Web so that your client can talk HTTP/1.1 through a gRPC-Web proxy (e.g. Envoy gRPC-Web) because you're unable to talk HTTP/2 directly to your service because of the Azure networking limitation?
In theory this should be possible. The JavaScript implementation is because, in-browser, there's no alternative except JSON transcoding. The JavaScript implementation does implement server-side streaming, which is another requirement and confirms that this should be possible over HTTP/1.1.
However, in a quick search I found no other (i.e non-JavaScript) client implementations of gRPC-Web.

Dispatching grpc requests to multiple servers via Nginx

Having a grpc client and server and they are exchanging messages in grpc unary mode. I want to log all the messages the client sends to the server without changing a single line of code in both client or server. I came across to Nginx with its new graceful grpc support. Is it possible to route grpc messages from client to server via Nginx while sending a copy of them to a remote logging service? If No, please let me know if there are any other tools out there that do the same stuff.

How to collect and pass b3 propagation headers in grpc client request using opentracing api?

I was using https://github.com/opentracing-contrib/java-grpc with jaegar tracer for enabling tracing in my grpc client program. Now I would like to use istio service mesh to handle tracing in server side. https://istio.io/latest/docs/tasks/observability/distributed-tracing/overview/ .
So the grpc client now needs to send the appropriate tracing HTTP headers along with each grpc client request so that istio can send those metrics to Jaegar. Does anyone have a working example of fetching the trace span information in grpc client and include the corresponding b3 propagation headers in a grpc client request?
Following http headers need to be passed in a java/C# grpc client request :
x-request-id
x-b3-traceid
x-b3-spanid
x-b3-parentspanid
x-b3-sampled
x-b3-flags
x-ot-span-context
Thanks.
Have a look at the OpenTelemetry-Java-Instrumentation project. It can provide automated tracing of your application without needing to write custom code. It uses an instrumentation agent that runs in the JVM beside your application.
java -javaagent:path/to/opentelemetry-javaagent-all.jar \
-jar myapp.jar
It supports exporting metrics to Jaeger
It also supports propagating headers to downstream requests.
They have just added support for b3-multi headers so a new release should be available in the coming days

Resources