klaus
klaus

Reputation: 93

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.

Upvotes: 4

Views: 7324

Answers (2)

Sathvik
Sathvik

Reputation: 654

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

Upvotes: 5

Oscar F
Oscar F

Reputation: 1149

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

Upvotes: 0

Related Questions