Add serializer adapter.

This commit is contained in:
Christian Kratky
2018-08-06 20:36:15 +02:00
parent cdb05e5894
commit 5a59cd278c
35 changed files with 471 additions and 224 deletions
@@ -14,15 +14,13 @@ namespace MQTTnet.AspNetCore.Client
{
if (options == null) throw new ArgumentNullException(nameof(options));
var serializer = new MqttPacketSerializer { ProtocolVersion = options.ProtocolVersion };
switch (options.ChannelOptions)
{
case MqttClientTcpOptions tcpOptions:
{
var endpoint = new DnsEndPoint(tcpOptions.Server, tcpOptions.GetPort());
var tcpConnection = new TcpConnection(endpoint);
return new MqttConnectionContext(serializer, tcpConnection);
return new MqttConnectionContext(new MqttPacketSerializerAdapter(options.ProtocolVersion), tcpConnection);
}
default:
{