rikulo / socket.io-client-dart

socket.io-client-dart: Dartlang port of socket.io-client https://github.com/socketio/socket.io-client
https://quire.io
MIT License
669 stars 181 forks source link

Still maintained? #276

Open ollyde opened 2 years ago

ollyde commented 2 years ago

Is this library still maintained?

I see many of the releases are many months ago. Still no support for V4 unless you use the Beta 2.0.0-beta.4-nullsafety.0

If it's not maintained can we get a deprecated flag on it so it pushes others to make alternative libraries :-)

RukshanJS commented 2 years ago

Is this library still maintained?

I see many of the releases are many months ago. Still no support for V4 unless you use the Beta 2.0.0-beta.4-nullsafety.0

If it's not maintained can we get a deprecated flag on it so it pushes others to make alternative libraries :-)

I agree. Although the 2.0.0-beta.4-nullsafety.0 version works, there are some nuances which cause errors for example issues during reconnecting the socket etc.

AFAIK one of the main issues with websockets is that the server and client sides should be compatible with each other. So currently the only working version (for me atleast) is this beta one. Would really love a new and maintained version.

ollyde commented 2 years ago

@RukshanJS it's been very solid for us, on all platforms (Web, Android, iOS, MacOS, and Windows) using it on production feels a bit risky though.

RukshanJS commented 2 years ago

Yes the main functionality is working but sometimes for example when internet reconnects, the socket connection does not kick in again (works on android emulator not on a physical device hence I assumed a problem with the package)... I guess I will have to do some debugging then. 🙃

ollyde commented 2 years ago

I find that if you call disconnect, destroy or dispose it never works again, instead we just do this

_socket?.clearListeners();

Then remake it.

huydq88 commented 2 years ago

I'm starting to worry about Flutter's retention in the future. And over the past 14 months, the Socket Io Client Beta version has not made any progress.

ollyde commented 2 years ago

@huydq88 nah Flutter is booming, just this library needs some love

RukshanJS commented 2 years ago

I find that if you call disconnect, destroy or dispose it never works again, instead we just do this

_socket?.clearListeners();

Then remake it.

Just wanted to thank you for this. This certainly helped clear out the excess listeners but still the reconnecting thing is not working as expected on a physical device. It just throws the SocketException and does not reconnect to old socket - unless I start a new socket connection. (but works fine as expected on emulator - no SocketException there).

Since this thread is for another discussion I'll try to debug and post a separate issue if this persists.

UPDATE - found related issue => #218

ollyde commented 2 years ago

@RukshanJS we're using it on many phyiscal devices, Android, iOS, MacOS Apps, Windows Apps, Web (lots of browses) and it reconnects just fine, perhaps it's a serverside issue?

ollyde commented 2 years ago

@jumperchen any thoughts?

RukshanJS commented 2 years ago

@RukshanJS we're using it on many phyiscal devices, Android, iOS, MacOS Apps, Windows Apps, Web (lots of browses) and it reconnects just fine, perhaps it's a serverside issue?

😃 is that so? My backend is NestJS and using the latest versions of the packages @nestjs/platform-socket.io@8.4.7 and @nestjs/websockets@8.4.7. I think they use socket.io@4.5.1 under the hood. I wonder what causes it to throw that SocketException in Flutter, only on the physical device. Tested several times to make sure as well. I'll update here for sure if I make any progress. Appreciate your support.

ollyde commented 2 years ago

@RukshanJS I had issues with some of the socket packages that were a bridge to socket-io. I was using a Apollo GraphQL, scrapped their built in adaptor and used the raw socket-io with a redis adaptor for scalability.

RukshanJS commented 2 years ago

@RukshanJS I had issues with some of the socket packages that were a bridge to socket-io. I was using a Apollo GraphQL, scrapped their built in adaptor and used the raw socket-io with a redis adaptor for scalability.

Oh maybe I should give it a try. Thanks for the tip 😃

rmControls commented 2 years ago

I am planning to start chat functionality to my app and was searching for socketIo support package... I found this but doesn't seems like it maintained from long time... Any other package suggestions? or is it possible to connect server without any package?? 🤔

ollyde commented 2 years ago

@rmControls could just use web-sockets, sure it requires a little more code and re-connection logic but it's possible and you get more control over bugs and connectivity.

RukshanJS commented 2 years ago

@ollydixon My socket reconnection issue is now fixed. I did some code cleaning on Flutter client and that must've fixed some listeners or instances of the socket (have to check it more). Now the reconnection is working on physical device as well as expected. So... it seems the package is ok like you said. Cheers!

rmControls commented 2 years ago

@RukshanJS if possible, can you please share the sample code which is working for you??

GabrielBB commented 2 years ago

@jumperchen just released a new version: https://github.com/rikulo/socket.io-client-dart/commit/e629e191657f482d155ee1574de5ca3f920b9d17

ollyde commented 2 years ago

@GabrielBB great thanks.

We really need union types 😂🙈 dynamic is dangerous.

Screenshot 2022-07-14 at 22 15 53
RukshanJS commented 2 years ago

@RukshanJS if possible, can you please share the sample code which is working for you??

Hi, really sorry couldn't get back to you earlier. I have hosted the full source code (with NestJS backend + Flutter frontend) which was a tutorial project that I did - https://github.com/RukshanJS/websockets-nestjs-flutter

In addition, I have written a complete tutorial that worked for me using this package. It is a three part series but if you want only the Flutter implementation, you can read the part 3 - https://dev.to/rukshanjs/part-33-how-to-create-a-server-side-timer-using-websockets-with-socketio-nestjs-and-flutter-10am or watch the part 3 on my YouTube channel https://youtu.be/kx7LQNNmTX4.

Very probable that you have found a working code by now... thought to share anyways..

rmControls commented 2 years ago

@RukshanJS thank you... that still helps....