Fixing support for Protobuf in SocialWeather (#1362)
This commit is contained in:
parent
4f7b8f5cf3
commit
bfb86b71df
|
|
@ -6,6 +6,7 @@ using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Sockets;
|
using Microsoft.AspNetCore.Sockets;
|
||||||
|
using Microsoft.AspNetCore.Sockets.Features;
|
||||||
|
|
||||||
namespace SocialWeather
|
namespace SocialWeather
|
||||||
{
|
{
|
||||||
|
|
@ -22,7 +23,16 @@ namespace SocialWeather
|
||||||
public void OnConnectedAsync(ConnectionContext connection)
|
public void OnConnectedAsync(ConnectionContext connection)
|
||||||
{
|
{
|
||||||
connection.Metadata["groups"] = new HashSet<string>();
|
connection.Metadata["groups"] = new HashSet<string>();
|
||||||
connection.Metadata["format"] = connection.GetHttpContext().Request.Query["formatType"].ToString();
|
var format = connection.GetHttpContext().Request.Query["formatType"].ToString();
|
||||||
|
connection.Metadata["format"] = format;
|
||||||
|
if (string.Equals(format, "protobuf", StringComparison.OrdinalIgnoreCase))
|
||||||
|
{
|
||||||
|
var transferModeFeature = connection.Features.Get<ITransferModeFeature>();
|
||||||
|
if (transferModeFeature != null)
|
||||||
|
{
|
||||||
|
transferModeFeature.TransferMode = TransferMode.Binary;
|
||||||
|
}
|
||||||
|
}
|
||||||
_connectionList.Add(connection);
|
_connectionList.Add(connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue