-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Giving cookie to WebSocket test #232
Comments
@Inateno I think this should work but I haven't tested it: config:
target: "some-target"
ws:
headers:
Cookie: "cookievalue"
scenarios:
# ... But if that works, it would set the same cookie for all virtual users. There's no support for setting cookies inside scenarios yet. |
No problem, testing with one user is ok. I'm gonna try this now. |
@hassy Is the any plan when to add support of setting cookie per users? I'm testing a socket.io application and there are multiple servers behind a load balancer. The load balancer will use sticky session by routing the requests to the same server with the value in the cookie. Thank you |
Not planned for any particular time at the moment @jamesjieye - PRs gladly accepted though. |
I just encountered this same need and did some local hacking to see what I could figure out, if anything. Thankfully, it turns out that more recent versions of socket.io (1.5.2+) now support adding extra headers via the "extraHeaders" option during creation of the Socket (see here). I've been able to confirm that updating Artillery's socket.io to the latest version (1.7.2) and adding in the new option works like a charm. Admittedly, I'm doing this work on a Windows box, so I can't run the provided unit tests to ensure I haven't destroyed something. As far as implementing this feature, the only drawback/caveat seems to be that the extra headers will only be applied once the first emit is encountered in the scenario flow. This means the actual setting of these headers and cookies needs to happen at the step-level, but only the first collection will actually be used. This leads me to think that the definition of these headers should probably be set at the scenario-level, but only evaluated once that first emit is encountered. I've forked the repository and am planning on putting together a PR for this issue once I'm happy with the implementation. |
Here is what worked for me: config:
target: 'http://localhost:8123'
socketio:
transports: ["websocket"]
extraHeaders:
Cookie: "name=Roman;" |
Hi,
I'm trying to benchmark a WebSocket but I can't find in the documentation how to set the cookie.
Any help ?
Thanks
The text was updated successfully, but these errors were encountered: