简体   繁体   中英

NodeJS for realtime communication between website and desktop application

I'm working on an application where (at the moment) an desktop application and a website run a "heartbeat" that checks for new commands in a database. If there are to many users that both run heartbeats from the desktop application and the website it might be heavy for the server. (We got several applications running on the same server)

Now I'm thinking about nodeJS as communication method between the website and a mysql datebase. The desktop application will still use an heartbeat to check against the same database as the website (The desktop application is written in C#).

Are there any other solutions that are preferred before nodeJS as realtime communication in terms of safety, reliability etc?

Are there any disadvantages of using NodeJS instead of an ordinary javascript setInterval?

Thanks in advance / H

Are there any other solutions that are preferred before nodeJS as realtime communication in terms of safety, reliability etc?

Node.js is an application framework. It's impossible to generalize safety, security, and reliability of all Node.js applications.

I'm working on an application where (at the moment) an desktop application and a website run a "heartbeat" that checks for new commands in a database. If there are to many users that both run heartbeats from the desktop application and the website it might be heavy for the server. (We got several applications running on the same server)

Node.js doesn't magically make things more efficient. It depends on how you write your application. In any case, it sounds like your database is going to take the bulk of the load anyway, so whatever sits out in front of that won't make much of a difference. It's impossible to say definitively... you have to test to find out.

Are there any disadvantages of using NodeJS instead of an ordinary javascript setInterval?

This is a non-sensical question. Are there any advantages to driving a car instead of using an ordinary gas pedal?

It sounds to me like the question you should be asking is about protocol between your server and your application. It sounds like you are trying to poll the database at regular intervals for new commands. I recommend not doing that if you can help it. Why doesn't the server notify the client if there is a new command to run? For this, you might need a pub/sub system (one is built into Redis if that makes things easier for you), in addition to a protocol that can be spoken by both your server application and your client application. Socket.IO might be a choice for this, but the .NET library seems to be discontinued. You could do simple line-delimited JSON over TCP.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM