WebSocket in a mock page

Source: Internet
Author: User
In the front-end page development, you can use the tools such as Charles, Fiddler, and so on to mock the HTTP request in the page, but the mock of the WebSocket request is helpless. This article shows a tool that can intercept websocket requests in a page and send custom data to intercepted WebSocket.

First step: Create a new debugging session in the Debug dialog box. In the following illustration, the new debugging session intercepts the WebSocket link containing the ' Taobao ' string.


The second step is to open the console in the first page of Taobao, create a new WS connection to Wss://taobao.com/mock/test://www, and bind the event response function


At this point, the Debug dialog prompts you to establish a debugging connection.


The third step, in the Debug dialog box to send a message, Taobao homepage of the console will output the message from the dialog box.



The fourth step, Taobao issued the WS message, will be intercepted sent to the Debugging dialog box



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.