[Project Combat] How to use Postman to call WebSocket program

1. Background

The project needs to use WebSocket for communication. After developing the WebSocket interface, it must be tested. The following is the method for Postman to call the WebSocket program.

2. Matters needing attention

2.1 Why choose Postman?

Recently, I have been using ApiFox to make interface calls, but the current version of ApiFox (2.2.26) does not support calling WebSocket programs. Well, I can only find another tool that supports calls, and that is the powerful Postman.

2.2 version support

Postman v8.5 and above support websocket, I am using version 10.11.1
insert image description here

When using Postman as a WebSocket program in 2021, it could only be used on the Web side, and the proxy program had to be enabled. Now it can support the desktop side. I lament the iteration speed of Postman!

3. How to call the WebSocket program

3.1 Create a new collection (or directory)

Click the + button in the upper left corner, click the Add Request button for the collection created in this way, it must be HTTP
insert image description here
, so you need to create a new collection. Click the New button in the upper right corner
insert image description here
to select this WebSocket Request
insert image description hereinsert image description here

Click ctrl+s to save,

insert image description here

Enter a collection name here.

insert image description here

3.2 New WebSocket request

Create a new request through Add Request+WebSocket.

insert image description here

3.3 The request connection is successful

insert image description here

insert image description here

Guess you like

Origin blog.csdn.net/wstever/article/details/129416560