-1

I have a Web App (PHP + Javascript) and a Desktop App (.NET C#).

Sometimes I need my applications to communicate in a bidirectional way, where web app send a information to desktop, the desktop processes the information and returns to webapp.

I'm in doubt between two solutions:

1 - Use a table in database - Web app --> DB <-- Desktop app I was thinking of using a 5 or 10 second loop.

2 - Socket.io I can use this with node.js.

What is the best way? Or What other solutions can I be using?

Thanks!! and stay home!

  • when a question leads to multiple opniond-bases answers, the community prefers to close it. you should read the following document to know more on how to ask https://stackoverflow.com/help/how-to-ask – Leo Apr 10 '20 at 06:05
  • There are [message queue libraries](https://dingyuliang.me/mq-best-10-message-queue-open-source-libraries/) available for free (like RabbitMQ, Rebus etc). You can try to find the one to be used from both c# and php. However one more level for messaging may be overkill. But from another point of view you do not need to think about sockets and your own communication protocol. – oleksa Apr 10 '20 at 08:27

1 Answers1

1

I am not sure whether you meant socket.io through your server or directly on the client, but I am aware of a few desktop apps that host a webserver on localhost for communication with a webapp. I am unfortunately unaware what this architecture is called.

+------------------------+       +-------+       +---------------------+
|Desktop App             |       |Web App|       |Web Server           |
|                        |       |       |       |                     |
| http://localhost:99999 +<----->+       +<----->+ http://example.com/ |
+------------------------+       +-------+       +---------------------+

You can use websockets between the Desktop App and Web App to avoid the Web App having to poll the Desktop App.

There are plenty of security considerations, such as "Cross-site request forgery" style attacks to the localhost.

Kevin
  • 525
  • 4
  • 8