ProxymanApp / proxyman-windows-linux

Public tracker for Proxyman Windows/Linux
https://proxyman.io/
MIT License
112 stars 4 forks source link

Websocket: Logic for WS #2 #297

Open NghiaTranUIT opened 1 year ago

NghiaTranUIT commented 1 year ago

Description

This ticket is for WebSocket (WS). It's similar to HTTP, which is an insecure connection.

This ticket should be implemented at the same time as #296

⚠️ Do not start the WSS ticket until this this ticket is reviewed and done.

How to start a Websocket

  1. Open Proxyman for macOS
  2. Clone this repo: https://github.com/NghiaTranUIT/websocket-usercases
  3. Start Proxyman for macOS on port 9090
  4. npm i
  5. npm run start_ws
  6. Observe the WebSocket flow on the app

Acceptance Criteria

NghiaTranUIT commented 1 year ago

Unit Tests

How to Setup the Unit Test + Websocket

  1. Add the WebSocket Repo to the Testing Folder -> Make sure we don't include it in the main app
  2. use exec() to run a command line. Ref: https://stackabuse.com/executing-shell-commands-with-node-js/
  3. Depending on what Unit Test cases, the script can be different. For example:
let script = "cd \(path) && pwd && npm run start_ws"
  1. Wait until the shell is finished
  2. ✅ Verify the command shell runs fine
  3. ✅ Get the FlowPool -> Get the first websocket message -> Assert the storage (Message total, data, ...)
NghiaTranUIT commented 1 year ago

How to test WS / WSS manually

  1. Open Proxyman
  2. Open Postman with Websocket
    • WSS: wss://ws.postman-echo.com/raw
    • WS: ws://echo.websocket.events
  3. Connect and type message
  4. For each message -> Observe the message on Proxyman app