Can connect to socket, but not getting the message I need
When I run a python script with python-socketio to connect to the socket I'm interested in, I can see the messages I want.
When I attempt to do the same thing using the JMeter WebSocket samplers, I do not see those messages.
Here is the Python & result. I run this while I run my JMeter script which simply makes a few REST API requests.
Note that this Cookie is what makes this work: it’s a session cookie from a login.
I use a Cookie Manager, so I thought this would not be the cause of the problem in JMeter.
sio.connect("<https://events.dev.xxx.com",> transports='websocket',
headers={'Sec-WebSocket-Extensions: permessage-deflate', 'Sec-Fetch-Dest: websocket',
'Sec-Fetch-Mode: websocket',
'Cookie: xxxSESSIONDEV=NTI3MzkwNWUtMTJmNS00Y2U0LTk1NGUtMjQ2Mzk5OTYxZWE0'})
Result
...
...
Received packet MESSAGE data 2["message","{\"locationId\":110,\"name\":\"GAME_STARTED\",\"payload\":{\"id\":146724,\"boxId\":2002,\"userId\":419,\"createdAt\":\"2022-03-02T14:35:31\",\"lastModifiedAt\":\"2022-03-02T14:35:36.752\",\"completedAt\":\"2022-03-02T14:35:36.621\",\"activationMethod\":\"TAG\",\"nfcTagId\":\"OONqDs87Si\",\"gameCount\":1,\"app\":false}}"]
...
...
Here is what I have tried:
It simply returns
[Frame 1]
0{"sid":"-cFd4kXc2PMtKDGOACB2","upgrades":[],"pingInterval":25000,"pingTimeout":20000}
[Message 2]
0{"sid":"-cFd4kXc2PMtKDGOACB2","upgrades":[],"pingInterval":25000,"pingTimeout":20000}
What am I missing? I'd rather stick with one tool than have to have a custom-code solution.
Thanks very much.
[This is really a question, not an enhancement, and I don’t know if it is a bug, so I just chose enhancement.]
Comments (6)
-
repo owner -
repo owner - changed status to invalid
-
reporter It was a different one, but my apologies for the confusion. In fact, I also used this:
which is in this suite.
-
repo owner - What did you get? “i don’t see the messages i want” is only half of the story, what did the plugin receive?
- Did you add the Sec-Fetch-xxx headers? I don’t know if it matters, but at least it could be a difference….
-
reporter When I use the Single Read Sampler, one of two things happens:
- most times, there is a read time-out
- at the beginning, I got something similar to what I wrote originally:
0{"sid":"xjgtMmJVHwCLtBHoACCn","upgrades":[],"pingInterval":25000,"pingTimeout":20000}
-
repo owner So the websocket connection works. Your problem is on a higher level, that is: the protocol that is running on top of the websocket connection. I can’t help you with that.
Best advice is to capture the session that works with WireShark and compare that with what your test plan is sending.
- Log in to comment
The screenshots are not from this plugin, you’re probably using https://github.com/fshutdown/JMeter-WebSocketSampler?