Can connect to socket, but not getting the message I need

Issue #230 invalid
Guy Levin created an issue

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)

  1. Guy Levin reporter

    It was a different one, but my apologies for the confusion. In fact, I also used this:

    which is in this suite.

  2. Peter Doornbosch 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….

  3. Guy Levin reporter

    When I use the Single Read Sampler, one of two things happens:

    1. most times, there is a read time-out
    2. at the beginning, I got something similar to what I wrote originally:
    0{"sid":"xjgtMmJVHwCLtBHoACCn","upgrades":[],"pingInterval":25000,"pingTimeout":20000}
    

  4. Peter Doornbosch 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.

  5. Log in to comment