Using SignalR client through a web proxy
Asked Answered
A

3

13

I am using the SignalR .NET client library to create a console app/win service to connect to a signal R Hub using HTTPS on the web. Some of these clients may require a web proxy to access the internet. Where/How do I set the web proxy for the SignalR client?

How on earth is this not a real Question guys? I cant get the signalR to connect to the web server hub when the client is behind a firewall/TMG proxy server.

Archangel answered 22/11, 2012 at 14:42 Comment(3)
Seriously, this is a real issue, and a real question! I would like this answered. How the heck do you set up SignalR to work behind a proxy?Pirouette
Agree, this is real question for me too!Illconditioned
And now I even have a right answer! Please reopen this question.Illconditioned
I
6

Use Connection.Proxy property for that - https://msdn.microsoft.com/en-us/library/microsoft.aspnet.signalr.client.connection.proxy(v=vs.111).aspx

Example:

var hubConnection = new HubConnection(url);
var webProxy = new WebProxy(new Uri(“address”));
webProxy.Credentials = new NetworkCredential(“Username”, “Password”);
hubConnection.Proxy = webProxy;
Illconditioned answered 31/3, 2015 at 9:4 Comment(0)
S
4

Try this:

var webProxy = new WebProxy(new Uri(proxyUrl));

var connection = new HubConnectionBuilder().WithUrl("signalR hub endpoint", h => h.Proxy = webProxy).Build();         
Sheave answered 2/7, 2018 at 21:1 Comment(0)
F
0

In fact we implemented signalr to have a kind of real time progress about some document generation.

Some of our customers couldn't create documents any more because the connection disconnected.

"Maybe" because of some proxy server who not really blocked but hold the request for a while to scan it, so that signalr client got a timeout

Fillip answered 24/3, 2015 at 8:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.