فهرست منبع

增加视频通信相关的处理逻辑

shenzaixin 6 سال پیش
والد
کامیت
85566f8202

+ 15 - 0
src/server/endpoints/v2/session.endpoint.js

@ -48,6 +48,9 @@ router.post("/", function (req, res) {
    let sessions = new Sessions();
    let participantArray = [];
    ///是否视频会议的会话
    let videoconferencing = false;
    participants = JSON.parse(participants);
    for (let j in participants) {
        participantArray.push(j + ":" + participants[j]);
@ -55,6 +58,18 @@ router.post("/", function (req, res) {
    ControllerUtil.regModelEventHandler(sessions, res);
    sessions.createSession(sessionId, sessionName, sessionType, participantArray);
    //视频会议的会话 szx add 20181121
    if (!payload.hasOwnProperty('videoconferencing') && payload.videoconferencing == 1){
        videoconferencing = true;
        //发送广播,给相关的与会人员
        for (let j in participants) {
            let participant = participants[j];
            let socketClient = ClientCache.findById(participant.userId);
            socketClient.emt("startVideoconference",{"session_id":sessionId});
        }
        
    }
});
/**

+ 2 - 1
src/server/handlers/socket.handler.js

@ -26,6 +26,7 @@ class SocketHandler {
    start() {
        let socketServer = this._socketServer;
        socketServer.sockets.on('connection', function (socket) {
            log.info('one user connection...');
            // 客户端注册
            socket.on('login', function (data) {
                if (!data.userId) {
@ -40,7 +41,7 @@ class SocketHandler {
                    //     return;
                    // }
                    log.error('User ' + data.userId + ' login');
                    log.info('User ' + data.userId + ' login');
                    if(!data.clientType||data.clientType=="patient"){
                        let patientClient = new PatientClient(socket, socketServer);
                        patientClient.userId = data.userId;

+ 2 - 1
src/server/resources/config/config.test.js

@ -1,7 +1,8 @@
"use strict";
let imDbConfig = {
    host: '172.17.110.160',
    //172.17.110.160
    host: '172.19.103.85',
    user: 'ssgg',
    password: 'ssgg',
    database: 'im_new',