本文介绍了WebSocket 和 STOMP 协议有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

WebSocket 和 STOMP 协议之间的主要区别是什么?

What are the major differences between WebSocket and STOMP protocols?

推荐答案

这个问题类似于询问 TCP 和 HTTP 之间的区别.我仍然会尝试解决您的问题,如果您刚开始,很自然会混淆这两个术语.

This question is similar to asking the difference between TCP and HTTP. I shall still try to address your question, its natural to get confused between these two terms if you are beginning.

简答

STOMP 派生于 WebSockets 之上.STOMP 只是提到了一些关于如何使用 WebSockets 在客户端和服务器之间交换消息帧的具体方式.

STOMP is derived on top of WebSockets. STOMP just mentions a few specific ways on how the message frames are exchanged between the client and the server using WebSockets.

长答案

WebSockets

它是一种允许客户端和服务器之间进行异步双向通信的规范.虽然类似于 TCP 套接字,但它是一种作为升级的 HTTP 连接运行的协议,在双方之间交换可变长度的帧,而不是流.

It is a specification to allow asynchronous bidirectional communication between a client and a server. While similar to TCP sockets, it is a protocol that operates as an upgraded HTTP connection, exchanging variable-length frames between the two parties, instead of a stream.

STOMP

它定义了客户端和服务器使用消息语义进行通信的协议.它没有定义任何实现细节,而是为消息传递集成解决了一个易于实现的有线协议.它在 WebSockets 协议之上提供了更高的语义,并定义了一些映射到 WebSockets 帧的帧类型.其中一些类型是...

It defines a protocol for clients and servers to communicate with messaging semantics. It does not define any implementation details, but rather addresses an easy-to-implement wire protocol for messaging integrations. It provides higher semantics on top of the WebSockets protocol and defines a handful of frame types that are mapped onto WebSockets frames. Some of these types are...

  • 连接
  • 订阅
  • 取消订阅
  • send(发送到服务器的消息)
  • message (用于从服务器发送的消息) BEGIN, COMMIT, ROLLBACK(交易管理)

这篇关于WebSocket 和 STOMP 协议有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-09 13:42