update realtime monitor

This commit is contained in:
Luke Pulverenti
2017-05-27 03:19:09 -04:00
parent 89ba154522
commit ffb68b0318
8 changed files with 50 additions and 32 deletions

View File

@@ -66,19 +66,19 @@ namespace Emby.Server.Implementations.Session
return SendMessage(name, new Dictionary<string, string>(), cancellationToken);
}
private async Task SendMessage(string name,
private Task SendMessage(string name,
Dictionary<string, string> args,
CancellationToken cancellationToken)
{
var url = PostUrl + "/" + name + ToQueryString(args);
await _httpClient.Post(new HttpRequestOptions
return _httpClient.Post(new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
}).ConfigureAwait(false);
});
}
public Task SendSessionEndedNotification(SessionInfoDto sessionInfo, CancellationToken cancellationToken)
@@ -159,8 +159,24 @@ namespace Emby.Server.Implementations.Session
public Task SendMessage<T>(string name, T data, CancellationToken cancellationToken)
{
// Not supported or needed right now
return Task.FromResult(true);
var url = PostUrl + "/" + name;
var options = new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
};
options.RequestContent = _json.SerializeToString(data);
options.RequestContentType = "application/json";
return _httpClient.Post(new HttpRequestOptions
{
Url = url,
CancellationToken = cancellationToken,
BufferContent = false
});
}
private string ToQueryString(Dictionary<string, string> nvc)