简体   繁体   English

如何使用SocketIO创建基于实时CRUD的Web应用

[英]How to Create Real-Time CRUD based web app using SocketIO

Please check this answer . 请检查此答案

What is suggested flow is good. 建议的流程是好的。

Eg Submit data to server: Use POST Submit data from server to browser: Socket are best. 例如,向服务器提交数据:使用POST从服务器向浏览器提交数据:套接字是最好的。

My question when to use sockets in CURD based web app. 我的问题是何时在基于CURD的Web应用程序中使用套接字。

I think using Websockets for CRUD is always valid, but it depends on your specific app's needs. 我认为将Websockets用于CRUD始终是有效的,但这取决于您特定应用程序的需求。

If creation (C) and updates (U) are performed often and require real-time data exchange - ie a stock trading app - you might want to use websockets for the C&U. 如果创建(C)和更新(U)经常执行,并且需要实时数据交换(即股票交易应用程序),则您可能希望将Websocket用于C&U。 I think google does that for google-docs, but I might be mistaken. 我认为google是针对google-docs这样做的,但我可能会误会。

If reading data is time sensitive, you might use websockets for R&D (read and delete)... 如果读取数据对时间敏感,则可以使用websockets进行研发(读取和删除)...

Using websockets for the Read (R) is quite common for realtime updates (news, chat messages etc'). 对于实时更新(新闻,聊天消息等),使用Websockets进行读取(R)非常普遍。

But usually, CRUD apps aren't time sensitive and mostly CRUD will be performed with an HTTP GET/POST request using a RESTful HTTP API. 但是通常,CRUD应用程序不是时间敏感的,并且大多数CRUD将使用RESTful HTTP API通过HTTP GET / POST请求执行。

As much as I love websockets, there are something that work great with simple HTTP ;-) 尽管我很喜欢websocket,但有些东西可以通过简单的HTTP很好地工作;-)

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

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