Websocket not upgraded


#1

Hi there

I am trying to make a real time application, including chat and notifications.
I followed documentations of AdonisJS line by line, and it finally works.

My .env file

ip: 127.0.0.1 // OR 0.0.0.0
port: 3335

for the mobile part, I use Flutter Flutter.io to make the apps, but there is a problem which I don’t know it is from Adonis side or Dart ( Flutter ) side.

My Adonis websocket works well inside browsers

Desktop Chrome Browser
ws://127.0.0.1:3335/chat OK

Real mobile devices Chrome Browser
ws://192.168.191.1:3335/chat OK            //( 192.168.191.1 is my pc ip )

Emulator Chrome Browser
ws://127.0.0.1:3335/chat OK         // if I forward my emulator port
ws://192.168.191.1:3335/chat OK
ws://10.0.2.2:3335/chat OK

I also changed my server ip to 0.0.0.0 so that requests other than localhost can reach it,

The problem is Flutter requests always fail with following error

WebSocketException: Connection to 'http://192.168.191.1:3335/chat#'
 was not upgraded to websocket

but on the other hand, the same code in Flutter can easily connect to
wss://echo.websocket.org url !

I almost read every topic about it, not sure this exception is related to which side, flutter or adonis js (Node JS).

Any idea, any experience, any suggestion

Thank you in advance


#2

hi i have a question can i connect a flutter app with adonisjs , are there problems ?


#3

Hey @ghost :wave:

Please, create your own topic and be more descriptive.