diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-05-27 07:42:49 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-05-27 07:42:49 -0400 |
| commit | 772fb88aabb822aa0d0a4988b12bae8686fe0465 (patch) | |
| tree | f49a12ab0ca543d9a1a3ea8494737330fd50ea2b /Emby.Server.Implementations/Session/HttpSessionController.cs | |
| parent | 84077e824df3bda4f74e12b961d4e962b0e04a42 (diff) | |
| parent | a76bbcfebe82452178836301ce1d1833968c50bd (diff) | |
Merge pull request #2667 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Session/HttpSessionController.cs')
| -rw-r--r-- | Emby.Server.Implementations/Session/HttpSessionController.cs | 26 |
1 files changed, 21 insertions, 5 deletions
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<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) |
