mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 11:34:57 +02:00
Update session ping
This commit is contained in:
parent
6519eebabb
commit
40889702d0
5 changed files with 6 additions and 17 deletions
|
@ -396,14 +396,9 @@ namespace Emby.Server.Implementations.Syncplay
|
||||||
SendCommand(session, BroadcastType.SingleSession, command);
|
SendCommand(session, BroadcastType.SingleSession, command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (request.Type.Equals(PlaybackRequestType.KeepAlive))
|
else if (request.Type.Equals(PlaybackRequestType.UpdatePing))
|
||||||
{
|
{
|
||||||
_group.UpdatePing(session, request.Ping ??= _group.DefaulPing);
|
_group.UpdatePing(session, request.Ping ??= _group.DefaulPing);
|
||||||
|
|
||||||
var keepAlive = new GroupUpdate<string>();
|
|
||||||
keepAlive.GroupId = _group.GroupId.ToString();
|
|
||||||
keepAlive.Type = GroupUpdateType.KeepAlive;
|
|
||||||
SendGroupUpdate(session, BroadcastType.SingleSession, keepAlive);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,9 +100,9 @@ namespace MediaBrowser.Api.Syncplay
|
||||||
public bool Resume { get; set; }
|
public bool Resume { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Route("/Syncplay/{SessionId}/KeepAlive", "POST", Summary = "Keep session alive")]
|
[Route("/Syncplay/{SessionId}/UpdatePing", "POST", Summary = "Update session ping")]
|
||||||
[Authenticated]
|
[Authenticated]
|
||||||
public class SyncplayKeepAlive : IReturnVoid
|
public class SyncplayUpdatePing : IReturnVoid
|
||||||
{
|
{
|
||||||
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
[ApiMember(Name = "SessionId", IsRequired = true, DataType = "string", ParameterType = "path", Verb = "POST")]
|
||||||
public string SessionId { get; set; }
|
public string SessionId { get; set; }
|
||||||
|
@ -255,11 +255,11 @@ namespace MediaBrowser.Api.Syncplay
|
||||||
/// Handles the specified request.
|
/// Handles the specified request.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="request">The request.</param>
|
/// <param name="request">The request.</param>
|
||||||
public void Post(SyncplayKeepAlive request)
|
public void Post(SyncplayUpdatePing request)
|
||||||
{
|
{
|
||||||
var currentSession = GetSession(_sessionContext);
|
var currentSession = GetSession(_sessionContext);
|
||||||
var syncplayRequest = new PlaybackRequest();
|
var syncplayRequest = new PlaybackRequest();
|
||||||
syncplayRequest.Type = PlaybackRequestType.KeepAlive;
|
syncplayRequest.Type = PlaybackRequestType.UpdatePing;
|
||||||
syncplayRequest.Ping = Convert.ToInt64(request.Ping);
|
syncplayRequest.Ping = Convert.ToInt64(request.Ping);
|
||||||
_syncplayManager.HandleRequest(currentSession, syncplayRequest);
|
_syncplayManager.HandleRequest(currentSession, syncplayRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Controller.Net;
|
using MediaBrowser.Controller.Net;
|
||||||
using MediaBrowser.Controller.Session;
|
using MediaBrowser.Controller.Session;
|
||||||
using MediaBrowser.Controller.Syncplay;
|
|
||||||
using MediaBrowser.Model.Services;
|
using MediaBrowser.Model.Services;
|
||||||
using MediaBrowser.Model.Syncplay;
|
using MediaBrowser.Model.Syncplay;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
|
|
|
@ -30,10 +30,6 @@ namespace MediaBrowser.Model.Syncplay
|
||||||
/// </summary>
|
/// </summary>
|
||||||
PrepareSession = 5,
|
PrepareSession = 5,
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The keep-alive update. An update to keep alive the socket.
|
|
||||||
/// </summary>
|
|
||||||
KeepAlive = 6,
|
|
||||||
/// <summary>
|
|
||||||
/// The not-in-group update. Tells a user that no group has been joined.
|
/// The not-in-group update. Tells a user that no group has been joined.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
NotInGroup = 7
|
NotInGroup = 7
|
||||||
|
|
|
@ -28,6 +28,6 @@ namespace MediaBrowser.Model.Syncplay
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A user is reporting its ping.
|
/// A user is reporting its ping.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
KeepAlive = 5
|
UpdatePing = 5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue