简体   繁体   English

仅Websocket与Websocket与其余用于发送消息的Websocket

[英]Websocket only vs Websocket with rest for sending messages

I learning Spring and I choose chat application as my training application. 我学习Spring,然后选择聊天应用程序作为培训应用程序。 I want implement all the best as it possible to learn good practices. 我想尽一切可能学习最佳做法。

Now, I want implement sending and receiving messages. 现在,我想实现发送和接收消息。 It is possible to do with websocket, but I also want receive response of that sending message to show client if his message was sent or not. 可以使用websocket,但是我还希望接收该发送消息的响应,以显示客户端是否发送了他的消息。 (similiar as messenger) (类似信使)

Is possible to do that with pure websocket in spring or should I use websocket for whole communication (sending and receiveing)? 春季是否可以使用纯websocket来做到这一点,还是应该使用websocket进行整个通信(发送和接收)?

Also I want later implement other stuff like sending files, getting some data like chat history and so on. 我还想稍后再实现其他功能,例如发送文件,获取一些数据(如聊天记录)等等。 And there is same question as above. 上面有同样的问题。 Should I use one websocket connection for that or use websocket channel just for one purpose, eg chatting, and other stufs where is no required realtime communication do with rest? 我应该为此使用一个websocket连接还是仅出于一种目的使用websocket通道,例如聊天和其他不需要实时通信即可休息的stufs? What are pros and cons? 优点和缺点是什么? Thanks in answer for advice. 感谢您的建议。

Have your recipuent send back a receipt object saying it received a message with message ID. 让您的收件人发回一个收据对象,说它收到了一条带有消息ID的消息。 If this doesn't come back in a certain time then mark it not received. 如果一定时间内未恢复正常,则将其标记为未收到。

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

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