如何使用Postman测试Stomp应用程序?
我正在使用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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(2)
使用 Postman 向 WebSocket STOMP 服务器发送消息:
套接字 URL:
ws://localhost:8080/gs-guide-websocket
目标/发布:
/app/hello
就我而言,我应该将名称从客户端发送到服务器
字符串名称
确保在末尾附加 ASCII NULL 字符 [编辑 ->角色面板]
关于 STOMP 框架 -> https://stomp.github.io/stomp-specification-1.2.html#STOMP_Frames
连接到套接字服务器->将 HEX 内容从 notepad++ 粘贴到邮递员中的消息选项卡 ->更改为二进制类型、十六进制子类型->单击“发送
正如您所看到的,消息已被广播。
要了解服务器如何工作,请查看此处的示例 -> 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
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
Connect to socket server -> Paste HEX content from notepad++ to message tab in postman -> Change to Binary type, Hexadecimal subtype-> Click Send
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
看看这篇文章。我认为这对您的要求很有用。
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