mirror of
https://github.com/ProxymanApp/Proxyman.git
synced 2026-04-25 16:15:55 +03:00
[GH-ISSUE #1521] Feature Request: Web socket support #1514
Labels
No labels
Discussion
Feature request
In Progress...
Plugins
Waiting response
Windows
Windows
bug
duplicate
enhancement
feature
good first issue
iOS
macOS 10.11
question
wontfix
✅ Done
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Proxyman#1514
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
@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.
@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
URLSessionWebSocketTaskbut still didn't see the data.The documentation states that:
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.
@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
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)@sgade commented on GitHub (Jan 31, 2024):
Thanks for taking the time to look into this, @NghiaTranUIT!
Yes, Apollo is shipping their own
WebSocketimplementation which is using theWebSocketStreamyou linked.However, the former is used as the default implementation for the
WebSocketClientwhich I replaced with an implementation usingURLSessionWebSocketTaskas the underlying system. And it didn't show up in Proxyman either.Adding Atlantis, it worked instantly. Switching back to the
WebSocketby 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.
@NghiaTranUIT commented on GitHub (Jan 31, 2024):
Thanks. I will write an example with
URLSessionWebsocketand 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)
@NghiaTranUIT commented on GitHub (Feb 2, 2024):
@sgade I confirmed that Proxyman can capture URLSessionWebsocketTask out of the box (No Atlantis framework).
iOS Simulator
iOS Device
@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 aURLRequestinstead of aURL. 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
URLwith aURLRequestinViewController.swift:30:@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.
@NghiaTranUIT commented on GitHub (Feb 4, 2024):
@sgade confirmed that
URLSessionWebsocketTaskdoesn't work if usingURLRequest. 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 👍
@sgade commented on GitHub (Feb 4, 2024):
@NghiaTranUIT thank you for confirming!
@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)@rakeshkarkare commented on GitHub (Jul 19, 2024):
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
@NghiaTranUIT commented on GitHub (Jul 19, 2024):
Sorry, Mock Websocket response hasn't been supported yet. Only Mock a HTTP(S) Response works.
@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.
@WingCH commented on GitHub (Feb 13, 2025):
hope can Mock Websocket!
@0x3dev commented on GitHub (May 3, 2025):
Hi team, what are the reasons which hold back the websocket mocking capability?
@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 👍
@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
@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.
@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.
@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.