Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using SignalR client through a web proxy

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.

like image 225
user1845354 Avatar asked Nov 22 '12 14:11

user1845354


2 Answers

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;
like image 95
Vlad Rudenko Avatar answered Nov 04 '22 11:11

Vlad Rudenko


Try this:

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

var connection = new HubConnectionBuilder().WithUrl("signalR hub endpoint", h => h.Proxy = webProxy).Build();         
like image 3
Harsh Avatar answered Nov 04 '22 11:11

Harsh