How to connect to AdonisJs socket with java socket io client?


I’m trying to connect to AdonisJs socket from android (java) with socket io’s own library.
first I wanna know if its even possible? if yes then why am I unable to connect?

on android I couldn’t get the error, but when I tried to connect through chrome I got this error:

“failed: Connection closed before receiving a handshake response”

and this is my code:

const Ws = use(‘Ws’)‘news’, ({ socket }) => {
console.log(‘a new subscription for news topic’)
this was the code provided in the website’s guide.

My Java code:


private WebSocketClient mWebSocketClient;
private Socket mSocket;
try {
IO.Options options = new IO.Options();
options.path = “/news”;
mSocket = IO.socket(“”,options);
} catch (URISyntaxException e) {




First, the path in client isn’t the channel on Adonisjs WS, you may need to define the path in config/socket.js
Also, if want to write a client connecting to Adonis WS, you will need the logic flow reference to this

you may have some helper method like here:

suggest you to have a look on the source code on official adonisjs ws client if you are creating a custom client on different platform: