mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-20 03:24:33 +08:00
Add proxy settings for WebSocket connections for .NET 451 and 461
This commit is contained in:
@@ -76,6 +76,29 @@ namespace MQTTnet.Client
|
||||
return this;
|
||||
}
|
||||
|
||||
#if NET452 || NET461
|
||||
|
||||
public MqttClientOptionsBuilder WithProxy(string address, string username = null, string password = null, string domain = null, bool bypassOnLocal = false, string[] bypassList = null)
|
||||
{
|
||||
if (_webSocketOptions == null)
|
||||
{
|
||||
throw new InvalidOperationException("A WebSocket channel must be set if MqttClientWebSocketProxy is configured.");
|
||||
}
|
||||
|
||||
_webSocketOptions.MqttClientWebSocketProxy = new MqttClientWebSocketProxyOptions
|
||||
{
|
||||
Address = address,
|
||||
Username = username,
|
||||
Password = password,
|
||||
Domain = domain,
|
||||
BypassOnLocal = bypassOnLocal,
|
||||
BypassList = bypassList
|
||||
};
|
||||
|
||||
return this;
|
||||
}
|
||||
#endif
|
||||
|
||||
public MqttClientOptionsBuilder WithWebSocketServer(string uri)
|
||||
{
|
||||
_webSocketOptions = new MqttClientWebSocketOptions
|
||||
|
||||
Reference in New Issue
Block a user