public ValueResult <SessionID> JoinSession(SessionID currentSession, int senderId, SessionID sid)       //(ValueResult<RoomModel> session)
        {
            try
            {
                // Session verlassen
                MessageBuffer mb = new MessageBuffer();
                SharedStateSerializer.serialize(ref mb, currentSession);
                Message m = new Message(mb, Message.MessagesType.COVISE_MESSAGE_VRBC_UNOBSERVE_SESSION);
                tcpSocket.send_msg(m);


                //neue Session setzen und Senden
                MessageBuffer mb2 = new MessageBuffer();
                SharedStateSerializer.serialize(ref mb2, sid);
                mb2.add(senderId);
                Message m2 = new Message(mb2, Message.MessagesType.COVISE_MESSAGE_VRBC_SET_SESSION);
                tcpSocket.send_msg(m2);

                return(new ValueResult <SessionID>(sid));
            }
            catch (Exception e)
            {
                log.Error("Method JoinSession is crashed!" + e);

                return(new ValueResult <SessionID>(e));
            }
        }
示例#2
0
        public ValueResult <SessionID> sendSetNewSessionMessage(int userId, string sessionName)
        {
            try
            {
                MessageBuffer mb  = new MessageBuffer();
                var           sid = new SessionID(userId, sessionName, false);
                SharedStateSerializer.serialize(ref mb, sid);
                mb.add(userId);
                Message msg = new Message(mb, Message.MessagesType.COVISE_MESSAGE_VRB_REQUEST_NEW_SESSION);
                send_msg(msg);
                ValueResult <SessionID> currentSession = new ValueResult <SessionID>();

                currentSession.Value = sid;
                return(currentSession);
            }
            catch (Exception e)
            {
                log.Fatal("Method sendSetNewSessionMessage is Crashed!" + e);

                return(new ValueResult <SessionID>(e));
            }
        }