Skip to content

RFC: Split sync and async crates #329

@1tgr

Description

@1tgr

I'd like to get some opinions on splitting the websocket-lite crate into two halves:

  • The existing websocket-lite to be trimmed to only the async functions
  • A new websocket-lite-sync crate with only the synchronous functions

On #230, @Gelbpunkt requested to remove the synchronous functions but I said they were useful: non-futures-based code is easier to optimise, and works fine provided you can dedicate a thread to a connection.

On #204, @jjl suggested that we could remove the tokio dependencies for apps that only use the synchronous code.

I propose that the websocket-lite and websocket-lite-sync crates have an identical API: for example, both crates expose a method ClientBuilder::connect, instead of separate connect and async_connect methods.

The websocket-codec crate gains a tokio feature, which causes it to impl the Encoder and Decoder traits from tokio_util. The crate gets its own Encoder and Decoder traits, regardless of the tokio feature.

Rather than copying and pasting the source code into two crates, I was considering using the im and im-rc crates' trick to compile two crates from one source tree.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions