how to send json data using WebSocket request-response Sampler

Issue #27 closed
Former user created an issue

From where can i add TextFrameFilter also how to send json data using WebSocket request-response Sampler. I have send the data like '{position: 2, userId: "137", date: "2017-06-22", popup: "no", nexPrev: "false"} {"dateFormat":"%b %d","title":"Compressed Air Generated (CFM)","graphDataDTOs":[],"isTrend":false,"isCustomer":true,"reportId":null,"stacking":"true","compCount":"0","compressorIds":[],"isSessionAlive":null}' in Request data text box. But i got error like

Response code: Websocket I/O error Response message: WebSocket I/O error: Read timed out

Comments (11)

  1. Peter Doornbosch repo owner

    I guess these are two questions, right?

    You can add a TextFrameFilter from the "Edit -> Add -> Config Element" menu. Works only when you've built the plugin from the "filter" branch (filter functionality is not yet released).

    You can send json data by putting the json data into the "Request Data" field or the request-response sampler. Can you explain why this was not clear to you? I thought the UI was pretty self-explanatory, but apparently it isn't...

    The error you got indicates that the server is not sending a response within the given time. Check the read-timeout set in the sampler, maybe it's to short.

    Regards, Peter

  2. anu shaji

    Thanks for your quick reply. I am very new to Jmeter so why asking these kind of silly question.Kindly dont mind

    1. I didnt get TextFrameFilter from "Edit -> Add -> Config Element" menu (PFA)
    2. I have changed the read time out to 60000. Still not getting . Iam attaching the screenshots. Please checkconfigelement.png1.PNG2.PNG3.PNG5.PNG7.PNG
  3. Peter Doornbosch repo owner
    1. So you are using an official release of this plugin. That's perfect, but that does not include filter functionality and that is because it's still in development. If you want to use it, you must checkout the source, switch to the filter brand and build the plugin yourself.

    2. Your server is not sending a response. Maybe the server does not understand the json you are sending? Checking the server logs might help.

    What is your client like? Is it a web-app? How does it create ws messages?

  4. anu shaji

    Thanks for your patience :) 1. Can you give me the link of source code 2. Its a webapp. Build in java. Some http requests that do login. And open WebSocket Sampler with ws protocol inside the application. this is the error in log file 1.PNG 2017/06/22 16:30:43 ERROR - eu.luminis.jmeter.wssampler.RequestResponseWebSocketSampler: I/O Error in sampler 'WebSocket request-response Sampler'. java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at eu.luminis.websocket.Frame.parseFrame(Frame.java:40) at eu.luminis.websocket.WebSocketClient.receiveText(WebSocketClient.java:341) at eu.luminis.jmeter.wssampler.RequestResponseWebSocketSampler.doSample(RequestResponseWebSocketSampler.java:86) at eu.luminis.jmeter.wssampler.WebsocketSampler.sample(WebsocketSampler.java:127) at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:475) at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:418) at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:249) at java.lang.Thread.run(Unknown Source) 2.PNG3.PNG3.PNG

  5. Peter Doornbosch repo owner

    Hi,

    1. Move your mouse over to the left-top of this window; there's a link called "Source". But it would be more convenient for you to git clone the repository.

    2. I think there is a misunderstanding. What i tried to make clear, is that the problem is not in JMeter or in the plugin. Your server does not reply. You cannot solve that by looking in the client log file. The client did not receive any answer from the server. To find out why, you must consult server log files or debug the server. I cannot help you with that, i did not develop your server.

    3. "Its a webapp. Build in java. Some http requests that do login. And open WebSocket Sampler with ws protocol inside the application." ??? I guess you meant "websocket connection" were you wrote "WebSocket Sampler"? If you wrote the java client that connects with the server and if that works correctly, then you should compare the payload send by the java application with the payload by the WebSocket Sampler. Tip: use wireshark to compare the payloads and find the difference.

  6. Peter Doornbosch repo owner

    Great!

    Just out of curiosity (and maybe it can help others with similar issue): what was causing the problem?

  7. changlihua

    I meat this problem too. When returns very fast, you can get a message string; When return costs about 3s, can not get back.1.PNG

    2.PNG

  8. Peter Doornbosch repo owner

    I don't think so (that you meet the same problem); this issue was about sending json.

    Furthermore, i don't understand your question and i can't read the screenshots. If you want help, explain your problem clearly.

  9. Log in to comment