Skip to content

Commit

Permalink
fix: ConcurrentDictionaryGroup has no WriteToAsync (single target) im…
Browse files Browse the repository at this point in the history
…plementation.
  • Loading branch information
mayuki committed Dec 13, 2019
1 parent fe76ca0 commit dc3d855
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/MagicOnion/Server/Hubs/Group.ConcurrentDictionary.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,20 @@ public Task WriteExceptAsync<T>(int methodId, T value, Guid[] connectionIds, boo

public Task WriteToAsync<T>(int methodId, T value, Guid connectionId, bool fireAndForget)
{
throw new NotImplementedException();
var message = BuildMessage(methodId, value);
if (fireAndForget)
{
if (members.TryGetValue(connectionId, out var context))
{
WriteInAsyncLockVoid(context, message);
logger.InvokeHubBroadcast(GroupName, message.Length, 1);
}
return TaskEx.CompletedTask;
}
else
{
throw new NotSupportedException("The write operation must be called with Fire and Forget option");
}
}

public Task WriteToAsync<T>(int methodId, T value, Guid[] connectionIds, bool fireAndForget)
Expand Down

0 comments on commit dc3d855

Please sign in to comment.