瀏覽代碼

Merge pull request #497 from cquesnel/feature/add-websocket-parameters

Add custom WebSocket parameters
release/3.x.x
Christian 6 年之前
committed by GitHub
父節點
當前提交
ba4fdfb51c
沒有發現已知的金鑰在資料庫的簽署中 GPG 金鑰 ID: 4AEE18F83AFDEB23
共有 2 個檔案被更改,包括 16 行新增2 行删除
  1. +4
    -2
      Source/MQTTnet/Client/MqttClientOptionsBuilder.cs
  2. +12
    -0
      Source/MQTTnet/Client/MqttClientOptionsBuilderWebSocketParameters.cs

+ 4
- 2
Source/MQTTnet/Client/MqttClientOptionsBuilder.cs 查看文件

@@ -92,11 +92,13 @@ namespace MQTTnet.Client
return this;
}

public MqttClientOptionsBuilder WithWebSocketServer(string uri)
public MqttClientOptionsBuilder WithWebSocketServer(string uri, MqttClientOptionsBuilderWebSocketParameters parameters = null)
{
_webSocketOptions = new MqttClientWebSocketOptions
{
Uri = uri
Uri = uri,
RequestHeaders = parameters?.RequestHeaders,
CookieContainer = parameters?.CookieContainer
};

return this;


+ 12
- 0
Source/MQTTnet/Client/MqttClientOptionsBuilderWebSocketParameters.cs 查看文件

@@ -0,0 +1,12 @@
using System.Collections.Generic;
using System.Net;

namespace MQTTnet.Client
{
public class MqttClientOptionsBuilderWebSocketParameters
{
public IDictionary<string, string> RequestHeaders { get; set; }

public CookieContainer CookieContainer { get; set; }
}
}

Loading…
取消
儲存