Skip to content

Updated Starscream to custom fork: fixes issue with remote peer closing connection #588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

JeneaVranceanu
Copy link
Collaborator

@JeneaVranceanu JeneaVranceanu commented Jul 7, 2022

Note: it includes CI updates to use macOS 12.

Here is the link to PR in Starscream library.
Here is also the link to the issue with all details and my findings.

I doubt that it will be merged anytime soon as there is no activity on the side of maintainers but the bug this PR fixes caused quite some problems some time ago.

I know there some work is happening on the network layer but I still think it will be a good bug fix as the issue we are having with the current version of Starscream is quite significant. The issue is that once the WebSocket connection is closed by the other end (by the server in our case), we will never know that it happened, so there is no way to reconnect back to the server.

I had this issue with the project I'm working on because backend developers are using a load balancer which drops WebSocket connections every 30 seconds.

@JeneaVranceanu
Copy link
Collaborator Author

JeneaVranceanu commented Jul 8, 2022

@yaroslavyaroslav Don't review/merge it! I've found out that I haven't uploaded all changes yet.
Will let you know as it's done.

What is left is the logic for auto-reconnect only in case when a connection is closed by a remote peer. It is done already, tested and working well for quite a while already.

@JeneaVranceanu
Copy link
Collaborator Author

JeneaVranceanu commented Jul 8, 2022

@yaroslavyaroslav False alarm. The auto-reconnect feature I've built is based on #446 from @odanylovych

It's not complicated but based on class WebsocketSubscription -> https://github.com/JeneaVranceanu/web3swift/pull/7/files

@JeneaVranceanu
Copy link
Collaborator Author

@yaroslavyaroslav Btw, we can take only the CI part from this PR to introduce xcodebuild docbuild into the CI pipeline.
If that was one of the intentions of following DocC guides.

xcodebuild docbuild can be used to publish docs on GitHub Pages, as you are most likely aware.
https://developer.apple.com/documentation/xcode/distributing-documentation-to-external-developers

@yaroslavyaroslav
Copy link
Collaborator

@JeneaVranceanu i'd agree with adding DocC for that library, but it should be merged to unstable branch, since 2.. branch CI runs (and always will) on Xcode 12.5 which is not having such tools.

Also GitHub pages are available only since Xcode 14, which is in beta yet.

@yaroslavyaroslav
Copy link
Collaborator

Speaking about Starscreem dependency. Aren't we were discuss migrate to some another Websocket library? @JeneaVranceanu @mloit

I haven't worked with WebSocket closely, but roughly googling gave me this. What do you think, folks, does it worth it?

@mloit
Copy link
Contributor

mloit commented Jul 20, 2022

We did talk about it, and I think it would be good if we could. Starscream is one of the major hurdles in being able to build the library on non-Apple platforms. Also as Jenea mentioned it seems to be no longer maintained, so we should move away from an aging library. We could go with either the native websocket API, or with the NIO implementation, though my preference is to avoid external dependencies. (Having said that I think NIO is fairly safe as it is maintained by Apple)

@yaroslavyaroslav
Copy link
Collaborator

@mloit oh, I've forgot about Nio one. I've played with it for awhile and really liked it. So my vote is up to it.

@yaroslavyaroslav
Copy link
Collaborator

@JeneaVranceanu Starscream is dropped from dependencies list for 3.0.0 release same as Websocket feature, therefore this PR will be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants