浏览代码

set binary mode

release/3.x.x
JanEggers 6 年前
父节点
当前提交
978694b3c0
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. +9
    -0
      Source/MQTTnet.AspnetCore/MqttConnectionHandler.cs

+ 9
- 0
Source/MQTTnet.AspnetCore/MqttConnectionHandler.cs 查看文件

@@ -1,4 +1,5 @@
using Microsoft.AspNetCore.Connections;
using Microsoft.AspNetCore.Connections.Features;
using MQTTnet.Adapter;
using MQTTnet.Serializer;
using MQTTnet.Server;
@@ -13,6 +14,14 @@ namespace MQTTnet.AspNetCore

public override async Task OnConnectedAsync(ConnectionContext connection)
{
// required for websocket transport to work
var transferFormatFeature = connection.Features.Get<ITransferFormatFeature>();
if (transferFormatFeature != null)
{
transferFormatFeature.ActiveFormat = TransferFormat.Binary;
}


var serializer = new MqttPacketSerializer();
using (var adapter = new MqttConnectionContext(serializer, connection))
{


正在加载...
取消
保存