web3swift
web3swift copied to clipboard
feat: adding support for WebSocket
WARNING: It's a WIP. If you wish to you can review the PR but it's not finished yet.
Summary of Changes
Adds support for WebSockets that will be part of 4.0 release.
DefaultWeb3SocketClient
was added and is based on the native URLSessionWebSocketTask
. It's wrapped in #if !os(Linux) ... #endif
so we can add a separate instance of DefaultWeb3SocketClient
for Linux based on some other library that supports Linux.
Issues that are left to resolve/add:
- Linux support;
- Location of Keystore. At the moment it's in the Web3Provider. This branch is based on #446 and that PR had moved the
attachedKeystore
to theweb3
class; - Tests;
- The rest of compile errors.
Test Data or Screenshots
empty
By submitting this pull request, you are confirming the following:
- I have reviewed the Contribution Guidelines.
- I have performed a self-review of my own code.
- I have updated my repository to match the
develop
branch. - I have included test data or screenshots that prove my fix is effective or that my feature works.
- I have checked that all tests work and swiftlint is not throwing any errors/warnings.
It could be missed in the rush, so I just refresh it: why do we consider adding websocket as 4.0 feature rather then minor update for the 3.* one @JeneaVranceanu?
It could be missed in the rush, so I just refresh it: why do we consider adding websocket as 4.0 feature rather then minor update for the 3.* one @JeneaVranceanu?
@yaroslavyaroslav I think we will have to change the way we store and manage AbstractKeystore
in the provider and or Web3
class. It's not yet completely decided. I'm going to focus on that in the following days as I'm back from holidays starting this week.
@JeneaVranceanu I'm really curious why the WebSocket will lead to changes that you've mentioned. Looking forward to hear from you, no rushing tho.