Unable to connect to webrtc server from jmeter

Viewed 20

I am trying to load test WebRTC server using JMeter.

The wss URL works fine in browser, but in JMeter it is returning 400 error in WebSocketOpenConnection.

URL that I am trying to hit is : wss://myserver Port 3004 Path socket.io/?userId=K&EIO=3&transport=websocket

Same URL is opening properly in Chrome.

JMeter logs:

2022-09-08 16:27:53,195 ERROR e.l.w.WebSocketClient: Ignoring user supplied header 'Connection=Upgrade' 2022-09-08 16:27:53,195 ERROR e.l.w.WebSocketClient: Ignoring user supplied header 'Upgrade=websocket' 2022-09-08 16:27:54,320 ERROR e.l.j.w.PingPongSampler: Sampler 'WebSocket Ping/Pong': there is no connection to re-use

Any idea what am I missing?

Thanks

1 Answers

If you have only one WebSocketOpenConnection sampler in your Test Plan that explains a lot.

Your JMeter test must represent a real user opening a real browser and accessing your web application with 100% accuracy and as a real user using a real browser you first should send a HTTP GET request to the page mainly to get some cookies which may be required for successful establishing of the WebSocket connection.

Once done you need to implement protocol upgrade mechanism to create the session.

And only then you should try to open a WebSocket connection and start sending and/or receiving messages/frames.

So you need to create the same network footprint as your browser (or other application) does and then the request will be successful. And don't forget about correlation of the dynamic parameters as this K&EIO user ID seems to be something generated.

Related