Пример #1
0
        public void HelloWorld(Message msg)
        {
            // Get context
            ICallback callback = OperationContext.Current.GetCallbackChannel <ICallback>();

            if (msg.IsEmpty || ((IChannel)callback).State != CommunicationState.Opened)
            {
                return;
            }
            string txt = Encoding.UTF8.GetString(msg.GetBody <byte[]>());

            // Callback client
            try
            {
                callback.BroadcastToNetClient(CreateSoapMessage($"Hello {txt}"));
            }
            catch
            {
                callback.BroadcastToBrowserClient(CreateByteArrayMessage($"Hello {txt}"));
            }
        }