Websocket: close 1005 (no status)

I’ve been trying to use ‘socket.send()’ to send a socket.io compliant message.
I’ve tried using some formats but nothing worked so far. For example:

socket.send(‘42,[“ACTION”,{“data”: “value”}]’);
socket.send(‘42[“ACTION”,{“data”: “value”}]’);
socket.send(‘[“ACTION”,{“data”: “value”}]’);

In the browser dev tools I can see that the message is being sent like so:

42[“ACTION”,{“data”: “value”}]

Whenever I send a message I get this error from the serve:

websocket: close 1005 (no status)

Please, can someone help me with that? What’s the proper way to send those messages?

HI @calderano,

k6 does not support socket.io currently :frowning:

Some people have managed to make it work, but I am not certain how successful this can be done and whether there are some limitations that can’t be overcome. From what that user did and your code it seems you are missing a / after 42 ?

Hey @mstoykov,

I had come across that issue and seen that comment.
I tried doing it like that but it didn’t work out for me, unfortunately.
I’ve also tried with a / after 42 but it didn’t work either.

Thanks anyway :slight_smile:

In case anyone is going through this situation…
I’ve managed to make it work like this:

socket.send(‘42[“ACTION”,{“data”: “value”}]’);

The first 2 messages are socket.io specific if I’m not mistaken. They made it possible for me to send any other messages…

1 Like

@calderano i have some questions about 2probe and 5… did you originally see them in devtools before trying to make the connection