szarykott / signalrs

SignalR protocol implementation in Rust
28 stars 14 forks source link

Improve end user experience #4

Closed xamgore closed 1 year ago

xamgore commented 1 year ago

Hi! Thank you so much for the library, I am able to migrate a game from .NET to Rust now 😌

While working with it, I've encountered several areas that may be improved.

  let client = {
    let mut builder = SignalRClient::builder(domain);
    builder.use_authentication(auth); // uses `&mut self` instead of `self`
    builder.build().await?
  };

It can be simplified to:

let client = SignalRClient::builder(domain)
  .use_authentication(auth)
  .build()
  .await?

The second place is a bug, the domain in the example above contains query string /sionline?token={}, but the .build() method doesn't really respect it. Check the code for more details.