Пример #1
0
        /// <summary>
        /// NOTE: we don't need an app-level ack for this method :-)
        /// </summary>
        public void PublicMessage(ISession session, PublicMessageRequest msgRequest)
        {
            if (session.User.IsDevoiced)
            {
                session.Send(new YouAreDevoicedNotification());
                return;
            }

            PublicMessage message = null;
            using (var uow = UnitOfWorkFactory.Create())
            {
                uow.Attach(session.User);
                message = new PublicMessage(session.User, msgRequest.Body);
                uow.PublicMessageRepository.Add(message);
                uow.Commit();
            }

            var dto = message.ProjectedAs<PublicMessageDto>();
            dto.Role = (UserRoleEnum)(int)session.User.Role;
            _sessionManager.SendToEachChatSessions(dto);
        }
		public void PublicMessage(PublicMessageRequest request)
		{
			ConnectionManager.SendRequest(request);
		}