How to keep a websocket connection alive?

Issue #69 closed
Former user created an issue

Hi Peter, So I have this connection where I have multiple websocket request-response samplers and at the end I have a Http request, were I upload a file followed by my last websocket request-response sample, and then I finally close the connection.

This works fine, but sometimes the upload takes longer time, which makes the last websocket request-response sample and the websocket close sample to fail, as the server automatically closes down the connection if it doesn't get any ping within a period of time.

I have looked at this issue, but it didn't help me: https://bitbucket.org/pjtr/jmeter-websocket-samplers/issues/37/how-to-keep-alive-open-websocket

Any suggestions on how I can solve this?

Comments (3)

  1. omar youssef

    (I wasn't logged in)

    By the way the errors I get are the following:

    From last websocket request-response samle Response code: Websocket I/O error Response message: WebSocket I/O error: end of stream

    From the websocket close sample Response code: Websocket I/O error Response message: WebSocket I/O error: Connection closed by remote host

  2. Peter Doornbosch repo owner

    Hi,

    If the server is sending ping's, you can solve it by adding a ping/pong filter and enable that it automatically responds to a ping (with a pong). But from the error messages you report, i'm afraid the server doesn't send ping's, so this probably won't help.

    If it's really the upload that takes long (and thus, blocks the thread), i'm afraid you'r out of luck. If you can control the server, the easiest solution would be to increase the server timeout.

    You could try the use https://jmeter-plugins.org/wiki/InterThreadCommunication/ in order to send the Http upload from a different thread, but i've never used it myself. If it works out, please let me know.

    Regards, Peter

  3. Log in to comment