RocketSimApp icon indicating copy to clipboard operation
RocketSimApp copied to clipboard

Display HTTP traffic (API requests)

Open grennis opened this issue 2 years ago ā€¢ 2 comments

Is your feature request related to a problem? Please describe. It's helpful to monitor network traffic of an app in development.

Describe the solution you'd like A lightweight HTTP monitor for just the app I'm debugging with json request/response would be great. If it just magically worked like other features, that would be awesome.

Describe alternatives you've considered There is proxyman to display network traffic (API requests) but it's a pretty heavyweight general purpose tool that does too much and shows me too much. I've also used other tools like flipper but those require modifying the app.

Additional context None

grennis avatar May 18 '22 01:05 grennis

Yeah, the question is whether we can build this in w/o the need for an in-app dependency. I'm expecting this to be to far off from what RocketSim is doing today, so I don't expect to implement this soon. Yet, I do like the idea, so I'll keep it open for future reference to revisit if possible.

AvdLee avatar May 25 '22 12:05 AvdLee

We could learn from this: https://stackoverflow.com/questions/64490125/ios-packet-tunnel-provider-with-local-on-device-server/64570110#64570110

Otherwise, we should look into injecting binaries into the Simulator:

  • https://theevilbit.github.io/posts/dyld_insert_libraries_dylib_injection_in_macos_osx_deep_dive/
  • https://github.com/icerockdev/moko-test/issues/2
  • https://github.com/ProxymanApp/atlantis

AvdLee avatar Apr 06 '23 14:04 AvdLee

I would love this as well! šŸ™Œ

sslash avatar Jun 26 '24 07:06 sslash

This is now available in 12.11.0: https://docs.rocketsim.app/features/hzQMSrSga7BGWvxdNVdwYs/network-monitoring/guS2qEK2RWWc3coihRQXZT

image

AvdLee avatar Jun 29 '24 12:06 AvdLee

@sslash @grennis I'd love to get your feedback on this feature and whether it fulfills your needs!

AvdLee avatar Jun 29 '24 12:06 AvdLee

@sslash @grennis I'd love to get your feedback on this feature and whether it fulfills your needs!

Very cool, will try it out this weekend. Thanks!

grennis avatar Jun 29 '24 12:06 grennis

@AvdLee The first time I hooked it up, it worked nicely. Then I tried later and it was consistently crashing with exception below. I doubt the error message is correct, I'm just running iOS 17.5. I sent details to your email:

"Thread 10: Fatal error: Could not get data from _swizzleURLSessionDataTaskDidReceiveData. It might causes due to the latest iOS changes. Please contact the author!"

grennis avatar Jun 29 '24 19:06 grennis

@AvdLee The first time I hooked it up, it worked nicely. Then I tried later and it was consistently crashing with exception below. I doubt the error message is correct, I'm just running iOS 17.5. I sent details to your email:

"Thread 10: Fatal error: Could not get data from _swizzleURLSessionDataTaskDidReceiveData. It might causes due to the latest iOS changes. Please contact the author!"

Getting the same.

UnknownCoder807 avatar Jun 29 '24 20:06 UnknownCoder807

@grennis @UnknownCoder807 did you change anything in terms of target device to get this crash? E.g. build on a device or a different Simulator?

AvdLee avatar Jun 30 '24 12:06 AvdLee

@grennis @UnknownCoder807 did you change anything in terms of target device to get this crash? E.g. build on a device or a different Simulator?

For me, I just installed the upgrade to rocketsim. Added the code as told in the instructions and it gave me this error when I tried to run in the simulator. Iā€™m using Xcode 15.3 and iPhone 15 pro max 17.4 simulator.

UnknownCoder807 avatar Jun 30 '24 12:06 UnknownCoder807

For me, I just installed the upgrade to rocketsim. Added the code as told in the instructions and it gave me this error when I tried to run in the simulator. Iā€™m using Xcode 15.3 and iPhone 15 pro max 17.4 simulator.

Yeah, same here. I am actually not able to get it to work anymore, it always throws that exception. Not sure what changed but I didn't switch simulators or try on a real device.

grennis avatar Jun 30 '24 20:06 grennis

Same here with Xcode 15.4, iPhone 15 Pro 17.5 I don't know if it can help but here are some more information:

  • I'm using the default URLSession with just the timeout and additionalHeaders modified
  • Most par of the AppDelegate is still Obj-C
  • I might have other dependencies that do swizzling such as AFNetworking

I hope it can help šŸ™

qeude avatar Jul 01 '24 10:07 qeude

Thanks a lot for reporting in all. 12.11.1 at least no longer throws an assertion, but logs a warning in the console instead. I've opened https://github.com/AvdLee/RocketSimApp/issues/538 to dive deeper into this!

AvdLee avatar Jul 01 '24 13:07 AvdLee