Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First crack at group grain #1

Open
wants to merge 1 commit into
base: basic-structure
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/Orleans.AspNetCore.SignalR.Core/Grains/IGroupGrain.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Orleans.AspNetCore.SignalR.Observers;
using System.Threading.Tasks;

namespace Orleans.AspNetCore.SignalR.Grains
{
public interface IGroupGrain : IGrainWithStringKey
{
/// <summary>
/// Adds server to group
/// </summary>
/// <param name="server">The server</param>
/// <returns></returns>
Task AddServer(IServerObserver server);

/// <summary>
/// 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
/// </summary>
/// <param name="server"></param>
/// <returns></returns>
Task ConfirmConnection(IServerObserver server);

/// <summary>
/// Removes server from group
/// </summary>
/// <param name="server">the server</param>
/// <returns></returns>
Task RemoveServer(IServerObserver server);

Task SendMessage(string method, params object[] args);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,9 @@ namespace Orleans.AspNetCore.SignalR.Observers
public interface IServerObserver : IGrainObserver
{
void SendHubConnection(string connectionId, Immutable<InvocationMessage> message);

void SendToGroup(string groupId, Immutable<InvocationMessage> message);

void SendToUser(string userId, Immutable<InvocationMessage> message);
}
}
}