Support skip negotiation connecting to SignalR
I’m trying to use this plugin to connect to a ASPNET Core Signalr service but the plugin connection sampler logs this in JMeter
Response code:101
Response message:Switching Protocols
And in the server I say errors: “Failed connection handshake”.
Is the plugin prepared for negotiation? In my case I need the client (plugin) to skip the negotiation anyway because the SignalR service is behind a load balancer.
Does the plugin support this scenario?
Thanks
Comments (4)
-
repo owner -
reporter Thank you very much for your explanation.
I was frustrated and looking at the wrong direction. I wrongly thought that your plugin would deal with specific protocols like SignalR at least for connection. Friday afternoons are not the best time for thinking
. I took another look today and finally I managed to connect successfully.
Anyway, long story short, after the Upgrade response (101) it’s necessary to send a text message to set up the JSON protocol and that way the SignalR connection is established with the server.
{"protocol": "json", "version": 1}?
(Notice the last character is the special ASCII record separator
0x1E
required for all messages)It’s all described here: https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/HubProtocol.md#overview
-
repo owner Cool. Thanks for the update, that might help others facing similar problems.
Cheers,
Peter -
repo owner - changed status to closed
- Log in to comment
Response 101, switching protocols is a normal step in setting up a websocket connection: it starts with a HTTP request/response and when the response code is 101, it means the websocket connection is established.
The fact that your server is behind a load-balancer doesn’t matter and certainly does not mean that the negotiation must be done differently or can be skipped.
SignalR is “just” a protocol on top of websockets. The plugin supports the WebSocket protocol, you have to do the SignalR part yourself, i.e. simulate its behaviour in the test plan (see “Can I use the websocket plugin for Protobuf, SignalR, Stomp, ...?“ in https://bitbucket.org/pjtr/jmeter-websocket-samplers/src/master/FAQ.md). Several people before you have done this successfully, so yes, it can be done.