[GH-ISSUE #1135] Proxyman swallows the first message in Action Cable websocket #1131

Closed
opened 2026-03-03 19:48:38 +03:00 by kerem · 4 comments
Owner

Originally created by @tkrajacic on GitHub (Feb 4, 2022).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1135

Originally assigned to: @NghiaTranUIT on GitHub.

Proxyman version? (Ex. Proxyman 1.4.3)

Version 3.0.0 (30000)

macOS Version? (Ex. mac 10.14)

12.2 (21D49)

Steps to reproduce

connect to an Action Cable Websocket using either Android or iOS
The welcome message never arrives at the client when Proxyman is intercepting traffic

Expected behavior

The initial welcome message that the Action Cable protocol sends is received


So I am not 100% certain this is Proxyman's fault, but the Action Cable Rails code unconditionally sends a {"type":"welcome"} message when a websocket is opened. (github.com/rails/rails@18707ab17f/actioncable/lib/action_cable/connection/base.rb (L175))

I am developing an iOS and Android app (this iOS app still uses Starscream, so I can actually see the websocket messages in Proxyman), the apps never receive the welcome message from Rails. As soon as I quit Proxyman (or I use the URLSessionWebSocketTask, which Proxyman doesn't intercept) all apps do get this message when connecting.
The WebSocket does get established in any case, and messages can be sent. So it is not that the WebSocket connection is failing. Clients do get the callback that the socket was opened successfully.
This is 100% reproducible. I have no idea how this could be Rails fault, so I am naïvely assuming it has to do something with Proxyman.
Could it be that Rails is sending its message so quickly that Proxyman drops it, as it isn't ready yet?

P.S.: I tried connecting using websocat from the command line, which also isn't intercepted by Proxyman, and the welcome message appears as expected.

P.P.S: I now tried with wscat, which allows me to easily optionally use a http proxy and indeed, without proxy this works fine, and as soon as I use Proxyman, the welcome message disappears.

image

Originally created by @tkrajacic on GitHub (Feb 4, 2022). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1135 Originally assigned to: @NghiaTranUIT on GitHub. ### Proxyman version? (Ex. Proxyman 1.4.3) Version 3.0.0 (30000) ### macOS Version? (Ex. mac 10.14) 12.2 (21D49) ### Steps to reproduce connect to an Action Cable Websocket using either Android or iOS The welcome message never arrives at the client when Proxyman is intercepting traffic ### Expected behavior The initial welcome message that the Action Cable protocol sends is received --- So I am not 100% certain this is Proxyman's fault, but the Action Cable Rails code unconditionally sends a `{"type":"welcome"}` message when a websocket is opened. (https://github.com/rails/rails/blob/18707ab17fa492eb25ad2e8f9818a320dc20b823/actioncable/lib/action_cable/connection/base.rb#L175) I am developing an iOS and Android app (this iOS app still uses Starscream, so I can actually see the websocket messages in Proxyman), the apps never receive the welcome message from Rails. As soon as I quit Proxyman (or I use the URLSessionWebSocketTask, which Proxyman doesn't intercept) all apps _do_ get this message when connecting. The WebSocket does get established in any case, and messages can be sent. So it is not that the WebSocket connection is failing. Clients do get the callback that the socket was opened successfully. This is 100% reproducible. I have no idea how this could be Rails fault, so I am naïvely assuming it has to do something with Proxyman. Could it be that Rails is sending its message so quickly that Proxyman drops it, as it isn't ready yet? P.S.: I tried connecting using `websocat` from the command line, which also isn't intercepted by Proxyman, and the welcome message appears as expected. P.P.S: I now tried with `wscat`, which allows me to easily optionally use a http proxy and indeed, without proxy this works fine, and as soon as I use Proxyman, the welcome message disappears. ![image](https://user-images.githubusercontent.com/873717/152468484-81862aec-ae4e-4dad-903e-87c835d78709.png)
kerem 2026-03-03 19:48:38 +03:00
Author
Owner

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

Thanks for your detailed issue. It’s super helpful for me to investigate the bug 👍

I’m on it and send you a Beta build soon 😊

<!-- gh-comment-id:1029610116 --> @NghiaTranUIT commented on GitHub (Feb 4, 2022): Thanks for your detailed issue. It’s super helpful for me to investigate the bug 👍 I’m on it and send you a Beta build soon 😊
Author
Owner

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

@tkrajacic if you don't mind, please check out this build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.0.0_Missing_the_first_ws_message.dmg

I was able to reproduce the bug and it now displays the first WS message 👍

Please let me know the result 😄

<!-- gh-comment-id:1030526913 --> @NghiaTranUIT commented on GitHub (Feb 5, 2022): @tkrajacic if you don't mind, please check out this build: https://proxyman.s3.us-east-2.amazonaws.com/beta/Proxyman_3.0.0_Missing_the_first_ws_message.dmg I was able to reproduce the bug and it now displays the first WS message 👍 Please let me know the result 😄
Author
Owner

@tkrajacic commented on GitHub (Feb 5, 2022):

Fantastic! Works like a charm now! Thank you!

Just out of curiosity, what was it? Why did no one else see this? :)

<!-- gh-comment-id:1030528418 --> @tkrajacic commented on GitHub (Feb 5, 2022): Fantastic! Works like a charm now! Thank you! Just out of curiosity, what was it? Why did no one else see this? :)
Author
Owner

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

Technically, there was a small bug after initializing the WebSocket from Proxyman. I forgot to forward the first byte to the server. Therefore, Proxyman would never retrieve "the first" WS message from the server.

If the first message is from the client (not from the server), it works as expected 👍

I guess people didn't see it because after establishing the WS, the client always sent the first message. So, there was no bug.

<!-- gh-comment-id:1030566962 --> @NghiaTranUIT commented on GitHub (Feb 5, 2022): Technically, there was a small bug after initializing the WebSocket from Proxyman. I forgot to forward the first byte to the server. Therefore, Proxyman would never retrieve "the first" WS message from the server. If the first message is from the client (not from the server), it works as expected 👍 I guess people didn't see it because after establishing the WS, the client always sent the first message. So, there was no bug.
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#1131
No description provided.