Page 2
Last updated
Last updated
Creating Socket.IO requests
Passing in the socket.io address and request body/payload
Supports text , json and binary formats for request body
API testing not supported
On socket.io server reconnection, message history is lost
Web socket traffic is not tracked in postman console
Unable to save socket.io request in postman collection
Below is a code snippet of how to initialise/init the server by attaching it to an existing http server in nodejs.
Currently we have an event joinRoom which will take in input from the client and emit an event roomUsers and roomSettings to the socket.io server.
A new Socket.IO request cannot be created by opening a new tab hence we need to go to New > WebSocket Request.
Select Socket.IO from the dropdown and key in the HTTP server url in the address bar.
We can start sending and receiving message once the connection is established.
In the screenshot 2.1 above you can see that I have added the joinRoom and roomUsers events which I have defined in my socket.io server code. I have used postman as a socket.io client to send an event joinRoom with a JSON input to the server.
In the messages section (refer to image 2.2), postman logs the joinRoom event along with the roomUsers event which the server should receive. The roomUsers event returns to us the number of users connected to that socket. Postman also supports searching and deletion of message logs.
Hope the above mentioned instructions will help you to send socket.io requests with Postman and provide a beginners insight to this new feature of Postman which is still in beta stage. Would love your feedback!
2.0 Messages, Listeners and input view2.1 Add in your server listeners
2.2 Overview of messages