public async Task <IActionResult> NotifyEntityUpdate(string userId, [FromBody] RealtimeEntityUpdateMessage message) { _logger.LogDebug($"UserId: {userId}\nMessage: {message.Channel}"); await _hub.SendUserAsync(userId, message.Channel, new object[] { message }); return(Ok(message)); }
private async Task _sendHubUpdate(string userId, RealtimeEntityUpdateMessage message) { using var client = _clientFactory.CreateClient("podnoms"); var payload = new StringContent( System.Text.Json.JsonSerializer.Serialize(message), Encoding.UTF8, "application/json"); var response = await client.PostAsync( $"realtime/update/{userId}", payload); if (!response.IsSuccessStatusCode) { _logger.LogError( $"Error updating realtime hub.\n\tReason: {response.ReasonPhrase}\n\t{response.Content}"); } }