diff --git a/src/Orleans.AspNetCore.SignalR.Core/Grains/IGroupGrain.cs b/src/Orleans.AspNetCore.SignalR.Core/Grains/IGroupGrain.cs new file mode 100644 index 0000000..5f7e64c --- /dev/null +++ b/src/Orleans.AspNetCore.SignalR.Core/Grains/IGroupGrain.cs @@ -0,0 +1,34 @@ +using Orleans.AspNetCore.SignalR.Observers; +using System.Threading.Tasks; + +namespace Orleans.AspNetCore.SignalR.Grains +{ + public interface IGroupGrain : IGrainWithStringKey + { + /// + /// Adds server to group + /// + /// The server + /// + Task AddServer(IServerObserver server); + + /// + /// This method is used to confirm the server is still up. The grain implementation will + /// expect this method to be invoked after is calls 'IServerObserver.SendToGroup'. IF this + /// isn't called after a certain amount of time, the server will be removed from the list of + /// servers that hold a connection to this group + /// + /// + /// + Task ConfirmConnection(IServerObserver server); + + /// + /// Removes server from group + /// + /// the server + /// + Task RemoveServer(IServerObserver server); + + Task SendMessage(string method, params object[] args); + } +} \ No newline at end of file diff --git a/src/Orleans.AspNetCore.SignalR.Core/Observers/IServerObserver.cs b/src/Orleans.AspNetCore.SignalR.Core/Observers/IServerObserver.cs index aa3026d..57e9d36 100644 --- a/src/Orleans.AspNetCore.SignalR.Core/Observers/IServerObserver.cs +++ b/src/Orleans.AspNetCore.SignalR.Core/Observers/IServerObserver.cs @@ -6,5 +6,9 @@ namespace Orleans.AspNetCore.SignalR.Observers public interface IServerObserver : IGrainObserver { void SendHubConnection(string connectionId, Immutable message); + + void SendToGroup(string groupId, Immutable message); + + void SendToUser(string userId, Immutable message); } -} +} \ No newline at end of file