ChilliCream / ChilliCream/graphql-platform

Support setting `ClientWebSocketOptions` using sockets client builder

Open
#6,022 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

🌶️ strawberry shake Area: Subscriptions
Dominant language
C#
Stars
5.8k
Forks
810
Avg merge
15h 39m
Merged PRs (30d)
98

Description

Product

Strawberry Shake

Is your feature request related to a problem?

I was interested in customizing the options for the .NET web socket used by the transport.

The WebSocketClient wrapper exposes the underlying socket so that you can access it from the sockets client builder, however it does so as a WebSocket instead of the subtype ClientWebSocket, which does not expose the Options.

The solution you'd like

If we could change the type of IWebSocketClient.Socket to ClientWebSocket, I would be able to customize these settings using the client builder:

builder.Services
    .AddConferenceClient()
    .ConfigureWebSocketClient(
        client =>
        {
            client.Uri = new Uri("ws://localhost:5050/graphql");
            client.Options.KeepAliveInterval = TimeSpan.FromSeconds(5);
        });

I realize this is technically a breaking change (if a consumer of your library has implemented this interface), and there is an easy workaround of casting. Perhaps something to include in the next major version bump?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with IWebSocketClient.cs and WebSocketClient.cs to trace the Socket type exposed to WebSocketClientBuilderExtensions.cs. Check how the builder configures the exposed socket and review the compatibility implications for interface consumers. Done means the builder can configure ClientWebSocket.Options as requested without breaking the transport.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.