web3swift icon indicating copy to clipboard operation
web3swift copied to clipboard

feat: adding support for WebSocket

Open JeneaVranceanu opened this issue 2 years ago • 3 comments

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 the web3 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.

JeneaVranceanu avatar Dec 20 '22 09:12 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 avatar Jan 09 '23 06:01 yaroslavyaroslav

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 avatar Jan 10 '23 19:01 JeneaVranceanu

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

yaroslavyaroslav avatar Jan 10 '23 20:01 yaroslavyaroslav