googollee / go-socket.io

socket.io library for golang, a realtime application framework.
Other
5.75k stars 840 forks source link

Support Socket.IO v4 #443

Closed sabloger closed 1 month ago

sabloger commented 3 years ago

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

googollee commented 3 years ago

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 commented 3 years ago

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

googollee commented 3 years ago

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

erkie commented 3 years ago

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.

googollee commented 3 years ago

@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?

erkie commented 3 years ago

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.

googollee commented 3 years ago

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.

sabloger commented 3 years ago

@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?

sshaplygin commented 3 years ago

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
googollee commented 3 years ago

@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, socket.io@1.0.0...1.0.2 is socket.io v3 with engine.io v3, socket.io@1.0.3...2.x.x is socket.io v4 with engine.io v3, and socket.io@3.0.0...latest is socket.io v5 with engine.io v4. The second protocol version in Step 3 should be socket.io@1.0.3...2.x.x is socket.io v4 with engine.io v3. New fourth version in Step 4 should be socket.io@3.0.0...latest is socket.io v5 with engine.io v4. Right?

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

sabloger commented 3 years ago

@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 :)

ddk2222-luck commented 2 years ago

How is the progress now? Any progress?

MSE99 commented 2 years ago

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

erkie commented 2 years ago

@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 :)

MSE99 commented 2 years ago

@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.

zishang520 commented 2 years ago

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

TorbenHammes commented 1 year ago

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

Poujhit commented 1 year ago

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

ucipass commented 1 year ago

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

erkie commented 1 year ago

@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! :)

thexpand commented 1 year ago

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

j796160836 commented 1 year ago

Any news about supporting Socket.io V4?

ZackKing commented 11 months ago

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

Chatenium commented 11 months ago

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

Sahil-4555 commented 9 months ago

@Chatenium is there any other implementation of the SocketIO in golang which supports SocketIO Client v4?

fanshuai commented 7 months ago

Change to use centrifuge, this project is actively updated and includes both client and server.

Repositories: https://github.com/orgs/centrifugal/repositories?type=all Official website: https://centrifugal.dev

JanYork commented 5 months ago

Is this project still actively maintained? Has it already added support for the latest version of the socket.io client?

Sahil-4555 commented 5 months ago

@JanYork This Library only supports up-to SocketIO client v1.4. you can use Gorilla Websocket to develop custom & dynamic events as per you need.