如何使用Postman测试Stomp应用程序?

发布于 2025-01-18 12:24:34 字数 113 浏览 4 评论 0原文

我正在使用Spring Websocket进行聊天应用程序后端。 通信的协议是踩踏的,我正在使用RabbitMQ作为消息代理。

我想使用Postman测试我的应用程序,但找不到任何有用的教程/视频。

I am making a chat application backend using spring WebSockets.
The protocol for communication is STOMP and I am using rabbitmq as a message broker.

I want to test my application using postman but I can't find any helpful tutorial/video.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

淡看悲欢离合 2025-01-25 12:24:34

使用 Postman 向 WebSocket STOMP 服务器发送消息

  • 套接字 URL:ws://localhost:8080/gs-guide-websocket

  • 目标/发布:/app/hello

  • 就我而言,我应该将名称从客户端发送到服务器字符串名称


  1. Open Postman ->新-> WebSocket

Postman


  1. 打开 Notepad++

Notepad++

确保在末尾附加 ASCII NULL 字符 [编辑 ->角色面板]

关于 STOMP 框架 -> https://stomp.github.io/stomp-specification-1.2.html#STOMP_Frames

SEND
destination:/app/hello

{"name":"test"}
 

  1. 将 ASCII 转换为十六进制

Notepad++

Notepad++


  1. 套接字连接

Postman

连接到套接字服务器->将 HEX 内容从 notepad++ 粘贴到邮递员中的消息选项卡 ->更改为二进制类型、十六进制子类型->单击“发送


  1. 验证”

网页

正如您所看到的,消息已被广播。

要了解服务器如何工作,请查看此处的示例 -> https://spring.io/guides/gs/messaging-stomp-websocket

Send Messages to a WebSocket STOMP Server Using Postman:

  • Socket URL: ws://localhost:8080/gs-guide-websocket

  • Destination/Publish: /app/hello

  • In my case I should send name from client to server String name


  1. Open Postman -> New -> WebSocket

Postman


  1. Open Notepad++

Notepad++

Make sure you append the end with ASCII NULL character [edit -> Character Panel]

About STOMP Frames -> https://stomp.github.io/stomp-specification-1.2.html#STOMP_Frames

SEND
destination:/app/hello

{"name":"test"}
 

  1. Convert ASCII to HEX

Notepad++

Notepad++


  1. Socket Connection

Postman

Connect to socket server -> Paste HEX content from notepad++ to message tab in postman -> Change to Binary type, Hexadecimal subtype-> Click Send


  1. Verification

webpage

As you can see, the message is broadcasted.

To see how the server is working, check out the example here -> https://spring.io/guides/gs/messaging-stomp-websocket

一场信仰旅途 2025-01-25 12:24:34

看看这篇文章。我认为这对您的要求很有用。
https://dev.to/dev.to/danielsc/danielsc/testesting-stesting-stomp-websocket-stomp-webocket-stomp-webocket--webocket---------------------------------------参差参与物与POSTMAN-218A

基本上,您必须将Sokect消息编码到Base64,并通过使用其WebSocket的功能通过Postman发送它

have a look on this post. I think it's usefull for your request.
https://dev.to/danielsc/testing-stomp-websocket-with-postman-218a

Basically you have to encode sokect message to Base64 and send it through postman by using its websocket feature

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文