[GH-ISSUE #1521] Feature Request: Web socket support #1514

Open
opened 2026-03-03 19:52:06 +03:00 by kerem · 21 comments
Owner

Originally created by @alexsm20 on GitHub (Feb 1, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1521

Description

Web socket support.

Why this feature/change is important?

We can stop using Charles (which can be unreliable) and start buying licenses from you instead.

Originally created by @alexsm20 on GitHub (Feb 1, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1521 ## Description Web socket support. ## Why this feature/change is important? We can stop using Charles (which can be unreliable) and start buying licenses from you instead.
Author
Owner

@NghiaTranUIT commented on GitHub (Feb 2, 2023):

Websocket (WS/WSS) is already supported. You can check out the Doc at https://docs.proxyman.io/advanced-features/websocket

If you means Websocket from iOS app, you should use Atlantis framework (https://github.com/ProxymanApp/atlantis) because URLWebsocketTask doesn't go through the Proxy by default. It's a known issues from Apple.

<!-- gh-comment-id:1413001559 --> @NghiaTranUIT commented on GitHub (Feb 2, 2023): Websocket (WS/WSS) is already supported. You can check out the Doc at https://docs.proxyman.io/advanced-features/websocket If you means Websocket from iOS app, you should use Atlantis framework (https://github.com/ProxymanApp/atlantis) because URLWebsocketTask doesn't go through the Proxy by default. It's a known issues from Apple.
Author
Owner

@sgade commented on GitHub (Jan 31, 2024):

I just stumbled across this issue myself. We are using web sockets for Apollo (GraphQL) subscriptions. I wrote a custom client implementation using URLSessionWebSocketTask but still didn't see the data.

The documentation states that:

From iOS 17 and macOS 14, Proxyman can capture WS/WSS from URLSessionWebSocketTask out of the box. No need to use the Atlantis framework.

Is that only for physical devices? I couldn't get it to work in the simulator without the Atlantis framework. If so, the documentation should clarify that.

<!-- gh-comment-id:1918993790 --> @sgade commented on GitHub (Jan 31, 2024): I just stumbled across this issue myself. We are using web sockets for Apollo (GraphQL) subscriptions. I wrote a custom client implementation using `URLSessionWebSocketTask` but still didn't see the data. The [documentation](https://docs.proxyman.io/advanced-features/websocket) states that: > From iOS 17 and macOS 14, Proxyman can capture WS/WSS from URLSessionWebSocketTask out of the box. No need to use the Atlantis framework. Is that only for physical devices? I couldn't get it to work in the simulator without the Atlantis framework. If so, the documentation should clarify that.
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 31, 2024):

I tested with iOS Simulator, with a URLSessionWebSocketTask, no Atlantis and it just works fine with a sample iOS 17 project.

https://github.com/ProxymanApp/Proxyman/assets/5878421/aee6db98-7655-40c7-89bd-a4a5b622ee5d


We are using web sockets for Apollo (GraphQL) subscriptions

I guess you're using this one: https://github.com/apollographql/apollo-ios/tree/main

I believe that Apollo doesn't use native URLSessionWebsocket, they use Input/OutputStream that doesn't support HTTP Proxy

Ref: github.com/apollographql/apollo-ios@6bdaf4eb46/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift (L47)

However, they support SOCKS Proxy: github.com/apollographql/apollo-ios@6bdaf4eb46/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift (L20)

  1. Open Proxyman -> Tools -> Proxy Setting -> Enable SOCKS Proxy at port 8889
  2. Provides a custom SOCKS Proxy to your Apollo library
  3. Proxyman will capture the WS/WSS from Apollo
<!-- gh-comment-id:1919077020 --> @NghiaTranUIT commented on GitHub (Jan 31, 2024): I tested with iOS Simulator, with a `URLSessionWebSocketTask`, no Atlantis and it just works fine with a sample iOS 17 project. https://github.com/ProxymanApp/Proxyman/assets/5878421/aee6db98-7655-40c7-89bd-a4a5b622ee5d ------------- > We are using web sockets for Apollo (GraphQL) subscriptions I guess you're using this one: https://github.com/apollographql/apollo-ios/tree/main I believe that Apollo doesn't use native URLSessionWebsocket, they use Input/OutputStream that doesn't support HTTP Proxy Ref: https://github.com/apollographql/apollo-ios/blob/6bdaf4eb46312dfc7ccefc9f683dc42d1db257b5/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift#L47 However, they support SOCKS Proxy: https://github.com/apollographql/apollo-ios/blob/6bdaf4eb46312dfc7ccefc9f683dc42d1db257b5/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift#L20 1. Open Proxyman -> Tools -> Proxy Setting -> Enable SOCKS Proxy at port 8889 2. Provides a custom SOCKS Proxy to your Apollo library 3. Proxyman will capture the WS/WSS from Apollo
Author
Owner

@sgade commented on GitHub (Jan 31, 2024):

Thanks for taking the time to look into this, @NghiaTranUIT!

Yes, Apollo is shipping their own WebSocket implementation which is using the WebSocketStream you linked.
However, the former is used as the default implementation for the WebSocketClient which I replaced with an implementation using URLSessionWebSocketTask as the underlying system. And it didn't show up in Proxyman either.

Adding Atlantis, it worked instantly. Switching back to the WebSocket by Apollo expectedly made it disappear from Proxyman again. So that is why I am wondering why it didn't work out-of-the-box as advertised.

What is that example app you are showing there? It doesn't seem to be the Atlantis example project.

<!-- gh-comment-id:1919338680 --> @sgade commented on GitHub (Jan 31, 2024): Thanks for taking the time to look into this, @NghiaTranUIT! Yes, Apollo is shipping their own `WebSocket` implementation which is using the `WebSocketStream` you linked. However, the former is used as the default implementation for the `WebSocketClient` which I replaced with an implementation using `URLSessionWebSocketTask` as the underlying system. And it didn't show up in Proxyman either. Adding Atlantis, it worked instantly. Switching back to the `WebSocket` by Apollo expectedly made it disappear from Proxyman again. So that is why I am wondering why it didn't work out-of-the-box as advertised. What is that example app you are showing there? It doesn't seem to be the Atlantis example project.
Author
Owner

@NghiaTranUIT commented on GitHub (Jan 31, 2024):

Thanks. I will write an example with URLSessionWebsocket and use Proxyman to capture (without using the Atlantis framework) and get back to you soon.


If Atlantis works for you, I recommend using it.

Websocket is quite tricky on iOS, even with Charles Proxy, it might not be able to capture it (if not using Atlantis)

<!-- gh-comment-id:1919350003 --> @NghiaTranUIT commented on GitHub (Jan 31, 2024): Thanks. I will write an example with `URLSessionWebsocket ` and use Proxyman to capture (without using the Atlantis framework) and get back to you soon. --------------- If Atlantis works for you, I recommend using it. Websocket is quite tricky on iOS, even with Charles Proxy, it might not be able to capture it (if not using Atlantis)
Author
Owner

@NghiaTranUIT commented on GitHub (Feb 2, 2024):

@sgade I confirmed that Proxyman can capture URLSessionWebsocketTask out of the box (No Atlantis framework).

iOS Simulator

Proxyman captures websocket from iOS Simulator

iOS Device

  • iPhone 15, iOS 17.3
    Proxyman captures websocket from iOS 17
<!-- gh-comment-id:1923696721 --> @NghiaTranUIT commented on GitHub (Feb 2, 2024): @sgade I confirmed that Proxyman can capture URLSessionWebsocketTask out of the box (No Atlantis framework). - Sample App: https://github.com/NghiaTranUIT/WebsocketWithProxyman ### iOS Simulator ![Proxyman captures websocket from iOS Simulator](https://github.com/ProxymanApp/Proxyman/assets/5878421/3dbfbeec-53b7-4e88-a019-100f6e64ee6f) ### iOS Device - iPhone 15, iOS 17.3 ![Proxyman captures websocket from iOS 17](https://github.com/ProxymanApp/Proxyman/assets/5878421/5ca4d104-9146-4237-94ae-5472152b01ce)
Author
Owner

@sgade commented on GitHub (Feb 2, 2024):

Thank you for the example project. I was doing everything the same except for using a different overload of webSocketTask(with:). This one accepts a URLRequest instead of a URL. According to Apple's documentation one can use this to set custom headers on the request.

The result with this is call that Proxyman does not show the request at all. Replacing the call with the request.url! instantly makes it show up in Proxyman.

To reproduce this issue in your example project, replace the URL with a URLRequest in ViewController.swift:30:

//      return session.webSocketTask(with: URL(string: "wss://ws.postman-echo.com/raw")!)
        return session.webSocketTask(with: URLRequest(url: URL(string: "wss://ws.postman-echo.com/raw")!))
<!-- gh-comment-id:1924105284 --> @sgade commented on GitHub (Feb 2, 2024): Thank you for the example project. I was doing everything the same _except_ for using a different overload of [`webSocketTask(with:)`](https://developer.apple.com/documentation/foundation/urlsession/3235750-websockettask). This one accepts a `URLRequest` instead of a `URL`. According to Apple's documentation one can use this to set custom headers on the request. The result with this is call that Proxyman does not show the request at all. Replacing the call with the `request.url!` instantly makes it show up in Proxyman. To reproduce this issue in your example project, replace the `URL` with a `URLRequest` in `ViewController.swift:30`: ```swift // return session.webSocketTask(with: URL(string: "wss://ws.postman-echo.com/raw")!) return session.webSocketTask(with: URLRequest(url: URL(string: "wss://ws.postman-echo.com/raw")!)) ```
Author
Owner

@NghiaTranUIT commented on GitHub (Feb 4, 2024):

In this case, I guess it's a bug from URLSessionWebsocketTask. If It's a bug from Proxyman, the WS connection must be failed.

Let me find a solution to make it work with URLRequest.

<!-- gh-comment-id:1925595751 --> @NghiaTranUIT commented on GitHub (Feb 4, 2024): In this case, I guess it's a bug from URLSessionWebsocketTask. If It's a bug from Proxyman, the WS connection must be failed. Let me find a solution to make it work with URLRequest.
Author
Owner

@NghiaTranUIT commented on GitHub (Feb 4, 2024):

@sgade confirmed that URLSessionWebsocketTask doesn't work if using URLRequest. I tried to add Proxy Config to URLSessionConfiguration (HTTPSProxy and SOCKSProxy are not available on iOS), and it didn't work either.

I believe that it's intended by Apple. The only solution is to use Atlantis 👍

<!-- gh-comment-id:1925607127 --> @NghiaTranUIT commented on GitHub (Feb 4, 2024): @sgade confirmed that `URLSessionWebsocketTask` doesn't work if using `URLRequest`. I tried to add Proxy Config to URLSessionConfiguration (HTTPSProxy and SOCKSProxy are not available on iOS), and it didn't work either. I believe that it's intended by Apple. The only solution is to use Atlantis 👍
Author
Owner

@sgade commented on GitHub (Feb 4, 2024):

@NghiaTranUIT thank you for confirming!

<!-- gh-comment-id:1925692999 --> @sgade commented on GitHub (Feb 4, 2024): @NghiaTranUIT thank you for confirming!
Author
Owner

@NghiaTranUIT commented on GitHub (Feb 5, 2024):

@sgade if you find any solution, please let me know. I will bring it to Proxyman. For now, the only solution I know is using Atlantis.

Or using the SOCKSProxy setting in apollo-ios.

Ref: github.com/apollographql/apollo-ios@6bdaf4eb46/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift (L20)

<!-- gh-comment-id:1926104926 --> @NghiaTranUIT commented on GitHub (Feb 5, 2024): @sgade if you find any solution, please let me know. I will bring it to Proxyman. For now, the only solution I know is using Atlantis. Or using the SOCKSProxy setting in `apollo-ios`. Ref: https://github.com/apollographql/apollo-ios/blob/6bdaf4eb46312dfc7ccefc9f683dc42d1db257b5/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift#L20
Author
Owner

@rakeshkarkare commented on GitHub (Jul 19, 2024):

I tested with iOS Simulator, with a URLSessionWebSocketTask, no Atlantis and it just works fine with a sample iOS 17 project.

CleanShot.2023-12-04.at.21.32.15.mp4

We are using web sockets for Apollo (GraphQL) subscriptions

I guess you're using this one: https://github.com/apollographql/apollo-ios/tree/main

I believe that Apollo doesn't use native URLSessionWebsocket, they use Input/OutputStream that doesn't support HTTP Proxy

Ref: github.com/apollographql/apollo-ios@6bdaf4eb46/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift (L47)

However, they support SOCKS Proxy: github.com/apollographql/apollo-ios@6bdaf4eb46/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift (L20)

  1. Open Proxyman -> Tools -> Proxy Setting -> Enable SOCKS Proxy at port 8889
  2. Provides a custom SOCKS Proxy to your Apollo library
  3. Proxyman will capture the WS/WSS from Apollo

Hi @NghiaTranUIT I am getting responses from websocket as similar to yours. Is there any way to mock the responses in proxyman ? Could you please share some hints

<!-- gh-comment-id:2238709211 --> @rakeshkarkare commented on GitHub (Jul 19, 2024): > I tested with iOS Simulator, with a `URLSessionWebSocketTask`, no Atlantis and it just works fine with a sample iOS 17 project. > > CleanShot.2023-12-04.at.21.32.15.mp4 > > We are using web sockets for Apollo (GraphQL) subscriptions > > I guess you're using this one: https://github.com/apollographql/apollo-ios/tree/main > > I believe that Apollo doesn't use native URLSessionWebsocket, they use Input/OutputStream that doesn't support HTTP Proxy > > Ref: https://github.com/apollographql/apollo-ios/blob/6bdaf4eb46312dfc7ccefc9f683dc42d1db257b5/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift#L47 > > However, they support SOCKS Proxy: https://github.com/apollographql/apollo-ios/blob/6bdaf4eb46312dfc7ccefc9f683dc42d1db257b5/Sources/ApolloWebSocket/DefaultImplementation/WebSocketStream.swift#L20 > > 1. Open Proxyman -> Tools -> Proxy Setting -> Enable SOCKS Proxy at port 8889 > 2. Provides a custom SOCKS Proxy to your Apollo library > 3. Proxyman will capture the WS/WSS from Apollo Hi @NghiaTranUIT I am getting responses from websocket as similar to yours. Is there any way to mock the responses in proxyman ? Could you please share some hints
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 19, 2024):

Sorry, Mock Websocket response hasn't been supported yet. Only Mock a HTTP(S) Response works.

<!-- gh-comment-id:2239048824 --> @NghiaTranUIT commented on GitHub (Jul 19, 2024): Sorry, Mock Websocket response hasn't been supported yet. Only Mock a HTTP(S) Response works.
Author
Owner

@NghiaTranUIT commented on GitHub (Jul 20, 2024):

FYI, if you're using iOS 17 or later, Apple has fixed this problem. Proxyman can now capture WS/WSS from URLSessionWebsocketTask with the following config.

<!-- gh-comment-id:2240971387 --> @NghiaTranUIT commented on GitHub (Jul 20, 2024): FYI, if you're using iOS 17 or later, Apple has fixed this problem. Proxyman can now capture WS/WSS from URLSessionWebsocketTask with the following [config](https://docs.proxyman.io/advanced-features/websocket#solution-1-recommended-for-ios-17-or-later).
Author
Owner

@WingCH commented on GitHub (Feb 13, 2025):

hope can Mock Websocket!

<!-- gh-comment-id:2655350375 --> @WingCH commented on GitHub (Feb 13, 2025): hope can Mock Websocket!
Author
Owner

@0x3dev commented on GitHub (May 3, 2025):

Hi team, what are the reasons which hold back the websocket mocking capability?

<!-- gh-comment-id:2848788440 --> @0x3dev commented on GitHub (May 3, 2025): Hi team, what are the reasons which hold back the websocket mocking capability?
Author
Owner

@NghiaTranUIT commented on GitHub (May 4, 2025):

The current websocket implementation is impossible to support, Mock or modify the websocket header. However, we have rewritten the entire websocket with new logic that makes Mock or Breakpoint is possible.

You can try this new Beta websocket at https://github.com/ProxymanApp/Proxyman/issues/2283#issuecomment-2844148182

After that, we will support Breakpoint first, the mocking it 👍

<!-- gh-comment-id:2848876118 --> @NghiaTranUIT commented on GitHub (May 4, 2025): The current websocket implementation is impossible to support, Mock or modify the websocket header. However, we have rewritten the entire websocket with new logic that makes Mock or Breakpoint is possible. You can try this new Beta websocket at https://github.com/ProxymanApp/Proxyman/issues/2283#issuecomment-2844148182 After that, we will support Breakpoint first, the mocking it 👍
Author
Owner

@WingCH commented on GitHub (May 4, 2025):

Can’t wait to try it out! WebSocket support is going to make my life so much easier

<!-- gh-comment-id:2848918395 --> @WingCH commented on GitHub (May 4, 2025): Can’t wait to try it out! WebSocket support is going to make my life so much easier
Author
Owner

@WingCH commented on GitHub (Jun 2, 2025):

Currently,iOS apps (Proxyman 2.29.0(22902))don't seem to support viewing WebSocket messages, but technically it should be feasible, as I've seen similar software that can do this. Hope it can support it.

<!-- gh-comment-id:2932893344 --> @WingCH commented on GitHub (Jun 2, 2025): Currently,iOS apps (Proxyman 2.29.0(22902))don't seem to support viewing WebSocket messages, but technically it should be feasible, as I've seen similar software that can do this. Hope it can support it.
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 3, 2025):

@WingCH Websocket is only available on Desktop apps (mac, Windows, Linux). I will soon support it on iOS.

<!-- gh-comment-id:2933039169 --> @NghiaTranUIT commented on GitHub (Jun 3, 2025): @WingCH Websocket is only available on Desktop apps (mac, Windows, Linux). I will soon support it on iOS.
Author
Owner

@MathisDetourbet commented on GitHub (Jan 22, 2026):

@NghiaTranUIT I did follow the tutorial you provide for iOS 17+ and I still don't succeed to get ws on proxyman. Websocket is working app side. Im using websocket from Apollo. What could be the issue? Proxyman is 6.4.0 (60400).
Ive enable SOCKS proxy on apollo ws client. The url session with configuration from the tutorial is passed to my apollo client.

<!-- gh-comment-id:3784757879 --> @MathisDetourbet commented on GitHub (Jan 22, 2026): @NghiaTranUIT I did follow the tutorial you provide for iOS 17+ and I still don't succeed to get ws on proxyman. Websocket is working app side. Im using websocket from Apollo. What could be the issue? Proxyman is 6.4.0 (60400). Ive enable SOCKS proxy on apollo ws client. The url session with configuration from the tutorial is passed to my apollo client.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#1514
No description provided.