Skip to content

Commit

Permalink
Separate call hub method with typed contract
Browse files Browse the repository at this point in the history
  • Loading branch information
C0nquistadore committed Aug 12, 2022
1 parent bf2a452 commit ab31738
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/PhoneBox.Abstractions/ITelephonyHub.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@ namespace PhoneBox.Abstractions
public interface ITelephonyHub
{
Task SendMessage(string message);
Task Call(CallInfo call);
}
}
6 changes: 6 additions & 0 deletions src/PhoneBox.Client/TelephonyHubListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ public Task SendMessage(string message)
Console.WriteLine($"Received message: {message}");
return Task.CompletedTask;
}

public Task Call(CallInfo call)
{
Console.WriteLine($"Received call: {call.DebugInfo}");
return Task.CompletedTask;
}
#endregion
}
}
2 changes: 1 addition & 1 deletion src/PhoneBox.Server/SignalR/TelephonyHubPublisher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public TelephonyHubPublisher(IHubContext<TelephonyHub, ITelephonyHub> hub)

public async Task OnCall(CallSubscriber subscriber, CallInfo call)
{
await _hub.Clients.User(subscriber.PhoneNumber).SendMessage("OnCall:" + call.PhoneNumber).ConfigureAwait(false);
await _hub.Clients.User(subscriber.PhoneNumber).Call(call).ConfigureAwait(false);
}
}
}

0 comments on commit ab31738

Please sign in to comment.