Locust and Websockets

83 views Asked by At

I want to make a simple Locust script for a WebSocket call preferably using aiohttp. Request URL:

wss://someurl/api/task/ws

Request Method:

GET

Staus code:

101 Switching Protocols

Using "Class" and "task" as Locust spesifics, how could that script look like using aiohttp?

1

There are 1 answers

0
Cyberwiz On

Have a look at the (somewhat incorrectly named) SocketIOUser in locust-plugins https://github.com/SvenskaSpel/locust-plugins/blob/master/examples/socketio_ex.py

aiohttp uses async which is a little complicated to combine with gevent/greenlets which Locust Users are based on.