detect invalid json with web socket messages

This commit is contained in:
Luke Pulverenti 2013-09-07 11:59:29 -04:00
parent df3b010703
commit 59f24493ce

View File

@ -132,10 +132,17 @@ namespace MediaBrowser.Server.Implementations.ServerManager
{
LastActivityDate = DateTime.UtcNow;
if (!message.StartsWith("{", StringComparison.OrdinalIgnoreCase))
{
_logger.Error("Received web socket message that is not a json structure: " + message);
return;
}
if (OnReceive == null)
{
return;
}
try
{
var stub = (WebSocketMessage<object>)_jsonSerializer.DeserializeFromString(message, typeof(WebSocketMessage<object>));