Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to test stomp application using 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.

like image 600
klaus Avatar asked Oct 15 '25 21:10

klaus


1 Answers

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

like image 90
Sathvik Avatar answered Oct 19 '25 13:10

Sathvik