question

stef-k avatar image
0 Votes"
stef-k asked FeiHan-MSFT edited

Connect to third party websocket service with SignalR

Can I use the SignalR library to connect to a third party websocket service to pull data?

I plan to use it in both a command line and an ASP.NET core application if that matters.

Is there a code example available? All examples are about ASP.NET projects using SignalR at server side where clients can connect to.

I'm interested to use it as a client from a C# project.

dotnet-csharpdotnet-standarddotnet-aspnetcore-realtime
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

FeiHan-MSFT avatar image
1 Vote"
FeiHan-MSFT answered FeiHan-MSFT edited

Hi @stef-k, if you check the official doc with example about using ASP.NET Core SignalR .NET client library, you can find that it enables us to connect to a SignalR hub by configuring the HubConnection to use HTTP-based transports to connect to the specified URL.

connect to a third party websocket service to pull data

If you'd like to implement a client to connect to a WebSocket endpoint, you can try to use the ClientWebSocket api.

https://github.com/dotnet/aspnetcore/blob/b795ac3546eb3e2f47a01a64feb3020794ca33bb/src/SignalR/samples/WebSocketSample/Program.cs


If the answer is helpful, please click "Accept Answer" and upvote it.

Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

With Regards,
Fei Han

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

DuaneArnold-0443 avatar image
0 Votes"
DuaneArnold-0443 answered

ASP.NET SignalR is Web server-side technology, a service, and it is not client-side technology.

But you can check it out in the SignalR forum in ASP.NET forums.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.