From ffb68b03184e98126cfa211de9f422c1b255b9e4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 27 May 2017 03:19:09 -0400 Subject: update realtime monitor --- .../Session/HttpSessionController.cs | 26 +++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'Emby.Server.Implementations/Session/HttpSessionController.cs') diff --git a/Emby.Server.Implementations/Session/HttpSessionController.cs b/Emby.Server.Implementations/Session/HttpSessionController.cs index 2acc3902f..92fa6c424 100644 --- a/Emby.Server.Implementations/Session/HttpSessionController.cs +++ b/Emby.Server.Implementations/Session/HttpSessionController.cs @@ -66,19 +66,19 @@ namespace Emby.Server.Implementations.Session return SendMessage(name, new Dictionary(), cancellationToken); } - private async Task SendMessage(string name, + private Task SendMessage(string name, Dictionary 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(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 nvc) -- cgit v1.2.3