problem with writing text message to a nodejs websocket server

Issue #32 closed
jean-marie created an issue

Hello

Using sampler "WebSocket Open Connection" I finally succeeded in opening a connection with nodejs server. I had forgotten to fullfill the path field with the all required information such as for instance : "/socket.io/?subcode=25&EIO=3&transport=websocket"

then i added the sampler "WebSocket Single Write Sampler" to write text information to the server using the previous existing connection

the problem is that no text message is sent to the server

is there any issue with nodejs about this ?

thanks in advance for any help

Jean-Marie

Comments (9)

  1. Peter Doornbosch repo owner

    Hi Jean-Marie,

    This plugin just sends/receives websocket messages and should with any server that (properly ;-)) implements the websocket protocol.

    Tips to find out what's going wrong: - check the server logs, maybe it gives a clue - use wireshark or a similar protocol analyzer / monitoring tool to see what's going on - for this plugin, switch on debug logging and check the jmeter.log file.

    To enable debug logging, add the following lines to jmeter.properties:

    log_level.eu.luminis.jmeter=DEBUG

    log_level.eu.luminis.websocket=DEBUG

  2. Peter Doornbosch repo owner

    Hi Jean-Marie,

    I created a sample test plan for socket.io chat sample (https://socket.io/get-started/chat/) which works quite well with a locally running chat server. You can find the test plan sample here: https://bitbucket.org/pjtr/jmeter-websocket-samplers/src/ccda9c8430b14dba7700399bd45a703d444642e0/samples/socket.io-chatserversample.jmx?at=master&fileviewer=file-view-default

    As you can see in the sample, you have two options: extract the sid from the http response or request the server to return the sid in a cookie.

    Socket.io / Engine.io has its own protocol that it talks on top of the ws connection. Unfortunately, this is not very well documented, but with a little help from wireshark and stackoverflow, i managed to create a test plan that works. When a client does not talk this protocol correctly, the server immediately closes the connection, for example, if you leave out the "Engine.io upgrade" step, the test will fail with a "unexpected frame type" error.

    I expect this sample will get you going. Please let me know if it doesn't.

  3. jean-marie reporter

    Hi Peter,

    many thanks for your solution that works for me too !

    I was out of work for 3 weeks so I couldn't let you know about the result

    It took me some time... to realise that the server receives a connection as soon as the http request is sent (from jmeter)

    now I can test a full scenario

    Jean-Marie

  4. Log in to comment