go-socket.io icon indicating copy to clipboard operation
go-socket.io copied to clipboard

Support Socket.IO v4

Open sabloger opened this issue 3 years ago • 24 comments

When I updated the socket.io client to the version 4, the server and client couldn't connect anymore. Please add support of the new version of client to the project.

Thanks

sabloger avatar Apr 29 '21 13:04 sabloger

After checking the new version 4, it changes a lot with the base protocol. It fixed some annoying thing, like the frame length as a string.

Adding support to version 4 is possible, but I think it's hard to compatible with the new version and the old version at the same time. It takes time to test with both versions, and may not cover all corner cases.

googollee avatar May 02 '21 16:05 googollee

@mrfoe7 As you are the actual active maintainer currently, what do you think about the compatibility?

googollee avatar May 02 '21 16:05 googollee

@erkie If I remember correctly, you are using sio in your project. What do you think about the compatibility?

googollee avatar May 02 '21 20:05 googollee

We just use a version of the client library that this library supports. Would be great to have this library support later versions, but the lack of maintainers should be kept in mind when adding complexity.

erkie avatar May 02 '21 20:05 erkie

@erkie Agreed. Only supporting the latest version fits for lacking maintainers, but make it hard to migrate. What kind of client are you using? Web version? Do you have app with socket io client?

googollee avatar May 02 '21 21:05 googollee

We use socket.io for our web app: https://feeder.co if you create an account you can see when it connects to our go server.

erkie avatar May 03 '21 16:05 erkie

The web client is easy to upgrade.

For the new version, I'd like to only support new version client first and mention the compatibility in the document. It could add the old version support later.

googollee avatar May 03 '21 20:05 googollee

@googollee As I used your lib it is supporting the old version well, So can't you tag this version as a version with support of old versions and make a new version to support new version?

sabloger avatar May 03 '21 22:05 sabloger

Hey, guys! Sorry, for long answer.

I am happy, that you come back, Googol ^^

As you are the actual active maintainer currently

WOW, I don't know about it. It is pleasant discovery for me :D

Last time ago i tried refactoring but i get down this idea. By current too difficult state to support project

what do you think about the compatibility?

It is normally that previous major version does not supported into new. We will can resolve this conflicts by package tags. I suggest next plan:

  1. Refactor current code base. Googol, nothing personal, but this code style so strange, hard to understand and read :( We need separate current code to domain subjects
  2. Fix travis ci for good checking new release. (Optionally migrate to gitlab action)
  3. Write unit test and refactor exists cases.
  4. Upgrade current version to second protocol version. Because it is so popular and more used version.
  5. And after thats steps migrate to new fourth version

sshaplygin avatar May 04 '21 13:05 sshaplygin

@sabloger Existing tags won't disappear. You could always fetch old tags in your project.

@mrfoe7 I think we need to have a design document first before refactor. The design was in my mind but I can't say I still remember all of them after a long time. I'd like to start the design from scratch in a new branch and see if it's possible to refactor the current code.

From https://github.com/socketio/socket.io-protocol, [email protected] is socket.io v3 with engine.io v3, [email protected] is socket.io v4 with engine.io v3, and [email protected] is socket.io v5 with engine.io v4. The second protocol version in Step 3 should be [email protected] is socket.io v4 with engine.io v3. New fourth version in Step 4 should be [email protected] is socket.io v5 with engine.io v4. Right?

BTW, I guess you mean GitHub action in step 1. ;)

googollee avatar May 04 '21 19:05 googollee

@sabloger Existing tags won't disappear. You could always fetch old tags in your project.

Yes I meant this, You can refactor the code to support only the new version, and anyone who needs the old version can use old tags.

I have been using your lib in my chat service since last year and it helped me a lot, I would be happy to join you to implement the new version support if needed :)

sabloger avatar May 05 '21 10:05 sabloger

How is the progress now? Any progress?

ddk2222-luck avatar Aug 19 '22 17:08 ddk2222-luck

Any progress?, i need this for a project and I'm willing to get my hands dirty and help in the move to v4.

MSE99 avatar Sep 13 '22 11:09 MSE99

@MSE99 great that you are wanting to help out! AFAIK there is no active development on this. If you're interested in helping out you can read this thread: https://github.com/googollee/go-socket.io/issues/192 or simply dive in! Make a PR and ping me and I can help review it :)

erkie avatar Sep 13 '22 11:09 erkie

@erkie I have a question, engine.io protocol version 4 has a reverse ping pong mechanism (where the server sends a ping message and client must respond with a pong), my question is when an initial connection is made via a polling transport the server sends an open packet with handshake data, the server is also required to send ping messages at specific intervals (pingInterval as mentioned in the protocol spec) should the server keep the initial connection (the one where the handshake was made with) alive? so it can send the ping message, or should it wait for a message packet before sending the ping packet also should all the packets be flushed as soon as an http request is made by the client the spec isn't very clear on this, i looked at the reference JavaScript implementation and i couldn't understand a lot but it seems that they don't keep connections alive but instead flush all packets whenever a request is made.

MSE99 avatar Sep 18 '22 12:09 MSE99

Any progress?, i need this for a project and I'm willing to get my hands dirty and help in the move to v4.

@MSE99 Hello, I have done v4 support for socket.io. If necessary, you can refer to and use this project: https://github.com/zishang520/socket.io

zishang520 avatar Sep 19 '22 05:09 zishang520

Hey there, are there some news on V3 or V4?

TorbenHammes avatar Jan 29 '23 23:01 TorbenHammes

what version of socket-io-client that this package work best with?

Poujhit avatar Feb 01 '23 10:02 Poujhit

One more vote for golang Socket.io V4 support please!

ucipass avatar Mar 05 '23 23:03 ucipass

@TorbenHammes @ucipass we need help! If more people were willing to help out, boy, this library, would support all versions of Socket.IO, be superfast, super great documentation. The sky's the limit! :)

erkie avatar Mar 06 '23 08:03 erkie

What's the difference between the current repo and this one https://github.com/zishang520/socket.io ?

thexpand avatar Apr 23 '23 19:04 thexpand

Any news about supporting Socket.io V4?

j796160836 avatar Jun 08 '23 01:06 j796160836

Any news about supporting Socket.io V4? our team need it

ZackKing avatar Dec 08 '23 09:12 ZackKing

Any news about supporting SocketIO v4? My angular project is failing if a install socket.io-client v2

Chatenium avatar Dec 16 '23 17:12 Chatenium