简体   繁体   English

如果您有很多请求,REST是一个好的解决方案吗?

[英]Is REST a good solution if you have lots of requests?

I want people to controll my arduino robot via the internet. 我希望人们通过互联网控制我的arduino机器人。 It's important that the controlling reacts very fast. 控制必须做出快速反应,这一点很重要。 The user may send many requests per second. 用户每秒可能发送许多请求。

Let me explain my architecture : 让我解释一下我的架构

The user connects to a web-frontend . 用户连接到Web前端 He can use a virtual joystick and buttons. 他可以使用虚拟操纵杆和按钮。 The frontend will then send orders ( like "motor1:255" "motor2:0".... ) to an application server (Wildfly). 然后,前端会将订单( 例如"motor1:255" "motor2:0".... )发送到应用程序服务器 (Wildfly)。

When a frontend-session starts, Wildfly will establish a connection to my computer or smartphone using a socket . 当前端会话开始时, Wildfly将使用套接字建立与我的计算机或智能手机的连接。 The orders will be passed to the arduino using bluetooth . 订单将通过蓝牙传递给arduino。 When a frontend-session is not longer active, the socket will be closed. 当前端会话不再活动时,套接字将关闭。

One Wildfly should be able to controll up to 10 robots. 一台Wildfly应该能够控制多达10个机器人。 One robot can be controlled by exactly one user. 一台机器人只能由一个用户控制。 Some developers use a mysql table and add a row for each incoming order. 一些开发人员使用mysql表并为每个传入订单添加一行。 I don't think this would work in my case. 我认为这不适用于我的情况。

Is it okay to use REST to send the orders from the frontend to the application server? 使用REST将订单从前端发送到应用程序服务器可以吗? Is there any other fast and secure way to transport the user input from the frontend to the business logic? 还有其他快速安全的方式将用户输入从前端传输到业务逻辑吗?

Goot 古特

REST, when properly understood and applied, is a solution for problems of long-term evolution and maintenance of your application. 如果正确理解和应用REST,它就是解决应用程序长期演进和维护问题的解决方案。 It doesn't seem to be your case. 看来情况并非如此。

What you mean is probably if an HTTP API is a good solution if you have lots of requests, and the answer is, it depends. 您的意思可能是如果您有很多请求,那么HTTP API是否是一个很好的解决方案,答案是,取决于它。 I'd probably look into something like ZeroMQ for doing what you want. 我可能会考虑使用ZeroMQ之类的工具来做您想要的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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