Ejemplo n.º 1
0
        private void _FinishRoom(Int64 roomId)
        {
            LiveMeeting room = null;

            if (!liveRoomList.TryGetValue(roomId, out room))
            {
                return;
            }

            //set finish time
            room.closeTime = DateTime.Now;
            room.Clients.ForEach(c =>
            {
                if (c.leaveTime == default(DateTime))
                {
                    c.leaveTime = room.closeTime;
                }
            });

            //send via callback
            BizGazeCallback.onMeetingEnd(room);

            //log to database
            _logService.FinishMeeting(room._meeting);

            room.Clients.ForEach(c => connSessionMap.TryRemove(c.connId, out _));
            room.Clients.Clear();
            room.Dispose();

            liveRoomList.TryRemove(roomId, out _);
        }
Ejemplo n.º 2
0
        public bool LeaveClient(string connectionId)
        {
            LiveMeeting room = getClientRoom(connectionId);

            if (room == null)
            {
                return(false);
            }


            var client = room.LeaveClient(connectionId);

            if (client == null)
            {
                return(false);
            }

            connSessionMap.TryRemove(connectionId, out _);

            //send via callback
            BizGazeCallback.onMeetingLeft(room, client);

            //log to database
            _logService.LeftMeeting(room._meeting, client.participant);

            return(true);
        }
Ejemplo n.º 3
0
        /*************************************************************************
        *
        *              Meeting Logic Functions
        *
        *************************************************************************/
        public LiveMeeting CreateRoom(Int64 roomId)
        {
            //if room is already on-going
            if (liveRoomList.TryGetValue(roomId, out LiveMeeting room) && room != null)
            {
                return(room);
            }

            //check if exist in database
            Meeting meeting = _meetingService.Get(roomId);

            if (meeting == null)
            {
                return(null);
            }

            //if exist, open meeting
            LiveMeeting liveMeeting = new LiveMeeting(meeting);

            if (liveRoomList.TryAdd(liveMeeting.Id, liveMeeting))
            {
                //send via callback
                BizGazeCallback.onMeetingStart(liveMeeting);

                //log to database
                _logService.StartMeeting(meeting);
                return(liveMeeting);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 4
0
        /**
         * **************************************************************************
         *
         *              Join GroupChattig | webinar
         *           in webinar  [ userId = 0 ] means Anonymous user
         *
         * **************************************************************************
         */
        public Client JoinClientToRoom(Int64 roomId, Int64 userId, string anonymousUserName, string connectionId)
        {
            LiveMeeting room = getRoomById(roomId);

            if (room == null)
            {
                return(null);
            }

            var client = room.JoinClient(userId, anonymousUserName, connectionId);

            if (client == null)
            {
                return(null);
            }

            connSessionMap[connectionId] = room;

            //send via callback
            BizGazeCallback.onMeetingJoined(room, client);

            //log to database
            _logService.JoinMeeting(room._meeting, client.participant);
            return(client);
        }