I have a function app project based on the DotnetIsolated-BidirectionChat sample code, running in isolated mode with a serverless SignalR resource in Azure. I'm trying to figure out a way that clients in a 'chat' get some sort of notification that the chat partner has disconnected.
The sample has a rudimentary OnDisconnected, but it does not do anything useful apart from logging:
[Function("OnDisconnected")]
[SignalROutput(HubName = "Hub")]
public void OnDisconnected([SignalRTrigger("Hub", "connections", "disconnected")] SignalRInvocationContext invocationContext)
{
_logger.LogInformation($"{invocationContext.ConnectionId} has disconnected");
}
Is it possible I can do ANYTHING meaningful in response to this function method being invoked by SignalR? At least the OnConnected returns a 'SignalRMessageAction' which the clients can listen for but OnDisconnected does not return anything.
I need to signal something (anything!) to connected clients that a client has disconnected. Is there anyway to do this? Maybe invoke a hub method in the OnDisconnected function method implementation? Or with the (new) Azure Event Grid integration, could an event subscriber in the Function App get a disconnect notification, which can be parlayed into a hub method invocation?
OnDisconnected appears to be somewhat 'without use' if all you can do is a log message.
I have a function app project based on the DotnetIsolated-BidirectionChat sample code, running in isolated mode with a serverless SignalR resource in Azure. I'm trying to figure out a way that clients in a 'chat' get some sort of notification that the chat partner has disconnected.
The sample has a rudimentary OnDisconnected, but it does not do anything useful apart from logging:
Is it possible I can do ANYTHING meaningful in response to this function method being invoked by SignalR? At least the OnConnected returns a 'SignalRMessageAction' which the clients can listen for but OnDisconnected does not return anything.
I need to signal something (anything!) to connected clients that a client has disconnected. Is there anyway to do this? Maybe invoke a hub method in the OnDisconnected function method implementation? Or with the (new) Azure Event Grid integration, could an event subscriber in the Function App get a disconnect notification, which can be parlayed into a hub method invocation?
OnDisconnected appears to be somewhat 'without use' if all you can do is a log message.