Example #1
0
        public async Task WebSendMessage(WebSendMessageMessage message)
        {
            var state = GetState(ConnectionKind.Web);

            if (state == null)
            {
                _logger.LogWarning($"No state for WebSendMessage");
                return;
            }
            if (string.IsNullOrEmpty(message.To) || string.IsNullOrEmpty(message.Body) || message.Body.Length > 5000 || message.To.Length > 32)
            {
                return;
            }
            string data = FormattableString.Invariant($"[\"{ArmaSerializer.Escape(message.To)}\",\"{ArmaSerializer.Escape(message.Body)}\"]");
            await Clients.Group(state.ArmaChannelName).SendAsync("Callback", "SendMessage", data);
        }
Example #2
0
 private static string ToData(IdMessage message)
 {
     return(FormattableString.Invariant($"[\"{ArmaSerializer.Escape(message.Id)}\"]"));
 }