can we use grpc instead of socket.io(websocket)? _Nodejs grpc - node.js

I am implementing a grpc server in nodejs . grpc is great. I want to know is it possible to send a message from grpc server to the client(not request/response)?
I know we have bidirectional communication in grpc with full-duplex. which means this is similar functionality we have in socket.io(websocket). how we can push messages to a single client? is it possible to track down grpc clients? or even better, get a heartbeat?

gRPC servers cannot initiate connections to clients. Your best bet is to initiate bidirectional streaming from the client, as you said. If your client applications also ran gRPC servers, the application server could initiate connections to them, but that may be a heavy-handed solution.

Related

Does pusher support bi-directional communication? If yes then how to implement it in Node.js?

I can see only one way communication in pusher docs i.e., from server to client. How to do it from client to server with node.js?
Pusher Channels does not support bidirectional transport. If you need to send data from your client to your server you will have to use another solution such as a POST request.
Channels does offer webhooks which can be triggered by certain events in the application and could be consumed by your server if they fit your requirements. However, webhooks are designed to keep you informed of certain events within your application rather than as a means of communication between client and server.

Simultaneous gRPC clients sync/async server

I'm just curious,
Does a sync gRPC server supports connection from multiples clients?
If not, and the async ones does?
And combination of async server/sync client? is even possible?
Yes, synchronous gRPC supports multiple connected clients out of the box. I have personally tested with up to 2000 simultaneously connected clients to an microservice written in Go exposing a single API.

socketio security issue and differences of socketio and long polling

What are the security issues for the socket io in nodejs
Which one is better for real time updation using node js. Either socket io or long polling.
Socket.io is a websocket. If you deploy your code in a shared hosting environment or if you are going via a firewall the websocket protocol might not work.
You can configure socket.io to default to a long-polling strategy in that case (which uses XHR requests). You will send your data normally to the websocket API, and it will decide which strategy to use. Long-polling is more cpu-consuming and it uses 2 sockets as it stablishes a 2 ways communication with the server.

Using nodejs as a client to a Websocket server. Is it still event driven

I would like to code a performance test creating hundreds of concurrent websocket connections to a vendor's server, that will randomly send/receive messages and then hangup.
Can I use Websockets with nodejs to do this and will this be considered event driven?
To be clear, I am not building a websocket server. I basically want to use nodejs as a client to connect to an outside websocket server but create hundreds of concurrent connections that it will respond to.
Thanks.
Yes you can use node.js and yes it will be event driven. All network I/O in node.js is exclusively asynchronous and event-driven.
Be aware substack's rant in the hyperquest README about node.js core http module's connection pooling, which you will want to make sure you bypass. Presumably you'll be using a helper library such as socket.io or sock.js. Just check that they will create the number of connections you want to a single server without any pooling or throttling.

Connect node.js and signalr via sockets

Is there anyway to send data though sockets from Node.JS to SignalR? I have a Node.JS app that sends realtime information as JSON format. The other app it's an MVC C# app that uses SignalR to send the data to the client via socket. I want tosen data from de nodejs to signalr and signal send that info to the client.
You might consider better solution for internal communication between processes. SignalR is meant to be used between .Net server and client using different authentication, handshake, protocol and network layer methods, which is inefficient for internal server communication.
Take a look on ZeroMQ, is well simple and very easy to use tool, meant especially for such cases. It has bindings for most languages including .Net and node.js.
There is js client for browser to communicate with Signal R server.
http://www.nuget.org/packages/SignalR.Js
You probably can extract js file from it and run from Node.js.
And probably standard Socket.IO will just work, you need to subscribe to proper events and go.
If you want a node.js client for signalR that doesn't require jQuery I started this one. It intentionally only supports websockets.
https://npmjs.org/package/signalr-client

Resources