Motivation

The current Swift SDK implementation only provides developers with an interface to interact with the WebSocket connection. We recommend using a third-party library called Starscream, which is a battle-tested solution and offers developers the easiest way to make our SDK work.

However, many wallets do not want to rely on third-party solutions or aim to reduce dependencies in line with their tech policies. As a result, they prefer to use their own native solutions, especially since the release of the new Swift version with native socket support.

Consequently, we lack consistency in how the network layer works, leading to various custom errors that developers encounter. This inconsistency makes it challenging to identify and guarantee the absence of problems, and it may affect the overall experience of users across different wallets/dapps.

Some wallets e.g. Trust self-built their socket logic for this reason but it is performing poorly. Through removing the Starscream dependency we hope that they can use our implementation and hence their users have a better WalletConnect experience.

Features

Requirements

  1. Networking is available out of the box.
  2. The SDK supports bug-free connection and reconnection.
  3. The SDK logs networking events.
  4. The SDK must cover all the possible edge cases that users/developers can encounter.

Proposed Solution

We will utilize URLSessionWebSocketTask to implement the WebSocket client, taking advantage of the WebSocket support provided by the current Swift version.

The native client will maintain support for the existing interface to ensure backward compatibility and provide an easy fallback option in case our native solution encounters issues, which is possible due to the relatively new and potentially buggy nature of URLSessionWebSocketTask.

Future Work