Search code examples
asp.net-corewebsocketjmetersignalrjmeter-plugins

Cannot read text from .net core signalr server using Single Read Sampler in Jmeter


I am trying to load test our web app which is a real time gaming app written using code using asp.net core and signalr technology. We are using JMeter WebSocket Samplers by Peter Doornbosch for websocket communication.But we are not able to get any messages from the signalr server(except the ping frames from the websocket layer). The text message I am trying to read is a broadcast from server to all connected clients, so I can see that the message has been received by the browser clients but the jmeter client is not getting it. I have sniffed traffic to both browser and jmeter client and found that the server messages are not at all received at jmeter client but are in browser. So I think I am missing some parameter or a header in the initial connection establishment step so the server is not able detect the jmeter client even though the webSocket connection is open at that time and websocket layer pings are getting reached to jmeter client.

Things done in Jmeter :-

  1. HTTP Request to the server end point of signalr and get the signalr connectionId as response extract it and keep in jmeter variable.
  2. Using Single Write Sampler to setup new websocket connection using the connectionId obtained in step 1 and sending a text frame to set Signalr data protocol "{"protocol":"json"}".(Copied as seen in browser's developer console)
  3. Using existing connection another Single Write Sampler to send text calling a signalr hub function to add to a signalr group.Here the in the hub function there is a broadcast written to all connected clients.
  4. Using a Single Read Sampler to read the broadcast from server mentioned in step 3.This step always results in response timeout error in jmeter.

Anybody having prior experience with jmeter and singnalr using webSocket as transport could shed some light? Any leads are welcome. Thanks in advance


Solution

  • As per questioner requested here my comment as an answer:

    For the write step I had to send a square character at the end , I could see this in the developer console of the browser when I checked what the website is doing. To my understanding it signals the "end" of your request. Without this square character it didn't work for me.

    I can't tell what unicode character this square character is but it seems to signal the end of a signalr write.

    I checked the unicodes and it could be this one: □ which is unicode 9633