正在显示
35 个修改的文件
包含
3420 行增加
和
0 行删除
.gitignore
0 → 100644
docs/README.md
0 → 100644
| 1 | +# DOCS FOLDER |
etc/README.md
0 → 100644
| 1 | +#CONF FOLDER |
etc/umd.template.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html> | ||
| 3 | +<head> | ||
| 4 | + <title>学点云课堂</title> | ||
| 5 | + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | ||
| 6 | + <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"> | ||
| 7 | + <link rel="stylesheet" href="stylesheets/style.css"/> | ||
| 8 | + </head> | ||
| 9 | + | ||
| 10 | +<body style="visibility: hidden "> | ||
| 11 | + <div class="container"> | ||
| 12 | + <div class="video_container"> | ||
| 13 | + <div class="video_wrapper"> | ||
| 14 | + <div id="video_mask"></div> | ||
| 15 | + <div id="video_div" | ||
| 16 | + class="hide"> | ||
| 17 | + <video id="video" | ||
| 18 | + autoplay | ||
| 19 | + autostart | ||
| 20 | + poster="./images/waiting.jpg" | ||
| 21 | + controls | ||
| 22 | + playsinline | ||
| 23 | + webkit-playsinline> | ||
| 24 | + 该设备不支持HTML5/VIDEO标签播放. | ||
| 25 | + </video> | ||
| 26 | + </div> | ||
| 27 | + <div id="btn_video" | ||
| 28 | + style="display: none;"></div> | ||
| 29 | + <div id="btn_document" | ||
| 30 | + style="display: none;"></div> | ||
| 31 | + <div id="live_document_container" | ||
| 32 | + style="display: none;"> | ||
| 33 | + <div> | ||
| 34 | + <div class="document_none"> | ||
| 35 | + <div class="text-center document_image"></div> | ||
| 36 | + <p class="text-center"> | ||
| 37 | + 矮油,还没有文档共享哦~ | ||
| 38 | + </p> | ||
| 39 | + </div> | ||
| 40 | + <div class="list_sliders"> | ||
| 41 | + <div class="slideWrapper"> | ||
| 42 | + <img class="slide"> | ||
| 43 | + </div> | ||
| 44 | + <div class="docAnno"></div> | ||
| 45 | + </div> | ||
| 46 | + </div> | ||
| 47 | + <div class="document_pager dn"> | ||
| 48 | + <p class="text-center">0/1</p> | ||
| 49 | + </div> | ||
| 50 | + </div> | ||
| 51 | + </div> | ||
| 52 | + </div> | ||
| 53 | + <div class="content_container"> | ||
| 54 | + <ul id="tabmenu_list" | ||
| 55 | + style="margin: 0;" | ||
| 56 | + class="nav nav-tabs" | ||
| 57 | + role="tablist"> | ||
| 58 | + <li role="chat" | ||
| 59 | + class="active"> | ||
| 60 | + <a role="tab" data-toggle="tab-message">聊天</a> | ||
| 61 | + </li> | ||
| 62 | + <li role="doc"> | ||
| 63 | + <a role="tab" data-toggle="tab-board">文档</a> | ||
| 64 | + </li> | ||
| 65 | + <li role="detail"> | ||
| 66 | + <a role="tab" data-toggle="tab-detail">详情</a> | ||
| 67 | + </li> | ||
| 68 | + </ul> | ||
| 69 | + <div class="tab_container"> | ||
| 70 | + <div role="tab-message" | ||
| 71 | + class="tab_body tab_message active"> | ||
| 72 | + <div class="tab_body_container"> | ||
| 73 | + <div id="panel_message" | ||
| 74 | + data-empty="true" | ||
| 75 | + class="message_container"> | ||
| 76 | + <p class="h5 text-center" | ||
| 77 | + style="color: #666;"> | ||
| 78 | + 暂未收到消息 | ||
| 79 | + </p> | ||
| 80 | + </div> | ||
| 81 | + </div> | ||
| 82 | + </div> | ||
| 83 | + <div role="tab-board" | ||
| 84 | + class="tab_body"> | ||
| 85 | + <div class="tab_body_container"> | ||
| 86 | + <div class="document_none"> | ||
| 87 | + <div class="text-center document_image"></div> | ||
| 88 | + <p class="text-center"> | ||
| 89 | + 矮油,还没有文档共享哦~ | ||
| 90 | + </p> | ||
| 91 | + </div> | ||
| 92 | + <div class="list_sliders"> | ||
| 93 | + <div class="slideWrapper"> | ||
| 94 | + <img class="slide"> | ||
| 95 | + </div> | ||
| 96 | + <div class="docAnno"></div> | ||
| 97 | + </div> | ||
| 98 | + </div> | ||
| 99 | + <div id="document_pager" | ||
| 100 | + class="document_pager dn"> | ||
| 101 | + <p class="text-center"> | ||
| 102 | + 0/1 | ||
| 103 | + </p> | ||
| 104 | + </div> | ||
| 105 | + </div> | ||
| 106 | + <div role="tab-detail" | ||
| 107 | + class="tab_body"> | ||
| 108 | + <div class="tab_body_container"> | ||
| 109 | + <div id="detail_wrapper" | ||
| 110 | + class="detail_wrapper"></div> | ||
| 111 | + </div> | ||
| 112 | + </div> | ||
| 113 | + <div class="input_container"> | ||
| 114 | + <div class="input_wrapper" | ||
| 115 | + style="overflow: hidden;"> | ||
| 116 | + <div class="btn_more"></div> | ||
| 117 | + <div class="btn_face"></div> | ||
| 118 | + <div style="float: right; width: 60px;"> | ||
| 119 | + <button id="btn_send" | ||
| 120 | + type="submit" | ||
| 121 | + class="btn btn-primary"> | ||
| 122 | + 发送 | ||
| 123 | + </button> | ||
| 124 | + </div> | ||
| 125 | + <div style="margin:0 84px 0 85px;"> | ||
| 126 | + <input id="txt_message" | ||
| 127 | + type="text" | ||
| 128 | + class="form-control" | ||
| 129 | + maxlength="20" onkeyup="this.value=this.value.replace(/^ +| +$/g,'')"> | ||
| 130 | + </div> | ||
| 131 | + </div> | ||
| 132 | + </div> | ||
| 133 | + </div> | ||
| 134 | + </div> | ||
| 135 | + | ||
| 136 | + <div class="panel_more" | ||
| 137 | + style="display: none;"> | ||
| 138 | + <div class="masker"></div> | ||
| 139 | + <div class="panel_inner"> | ||
| 140 | + <div class="list_buttons"> | ||
| 141 | + <ul> | ||
| 142 | + <li class="btn_layout" | ||
| 143 | + data-layout="live"> | ||
| 144 | + <div> | ||
| 145 | + 直播布局 | ||
| 146 | + </div> | ||
| 147 | + </li> | ||
| 148 | + <li class="btn_night"> | ||
| 149 | + <div> | ||
| 150 | + 夜间模式 | ||
| 151 | + </div> | ||
| 152 | + </li> | ||
| 153 | + </ul> | ||
| 154 | + <div class="btn_close"> | ||
| 155 | + <span></span> | ||
| 156 | + </div> | ||
| 157 | + </div> | ||
| 158 | + </div> | ||
| 159 | + </div> | ||
| 160 | + | ||
| 161 | + <div class="list_faces" | ||
| 162 | + style="display: none;"> | ||
| 163 | + <div class="list_faces_scroller"> | ||
| 164 | + <ul> | ||
| 165 | + <li><img data-src="images/face/aimu.gif" data-type="aimu"> | ||
| 166 | + </li> | ||
| 167 | + <li><img data-src="images/face/daxiao.gif" data-type="daxiao"> | ||
| 168 | + </li> | ||
| 169 | + <li><img data-src="images/face/huaixiao.gif" data-type="huaixiao"> | ||
| 170 | + </li> | ||
| 171 | + <li><img data-src="images/face/liuhan.gif" data-type="liuhan"> | ||
| 172 | + </li> | ||
| 173 | + <li><img data-src="images/face/shuijiao.gif" data-type="shuijiao"> | ||
| 174 | + </li> | ||
| 175 | + <li><img data-src="images/face/yiwen.gif" data-type="yiwen"> | ||
| 176 | + </li> | ||
| 177 | + <li><img data-src="images/face/aoman.gif" data-type="aoman"> | ||
| 178 | + </li> | ||
| 179 | + <li><img data-src="images/face/jiew.gif" data-type="jiew"> | ||
| 180 | + </li> | ||
| 181 | + <li><img data-src="images/face/liulei.gif" data-type="liulei"> | ||
| 182 | + </li> | ||
| 183 | + <li><img data-src="images/face/sun.gif" data-type="sun"> | ||
| 184 | + </li> | ||
| 185 | + <li><img data-src="images/face/youhh.gif" data-type="youhh"> | ||
| 186 | + </li> | ||
| 187 | + <li><img data-src="images/face/baiyan.gif" data-type="baiyan"> | ||
| 188 | + </li> | ||
| 189 | + <li><img data-src="images/face/fadai.gif" data-type="fadai"> | ||
| 190 | + </li> | ||
| 191 | + <li><img data-src="images/face/jingkong.gif" data-type="jingkong"> | ||
| 192 | + </li> | ||
| 193 | + <li><img data-src="images/face/meiyan.gif" data-type="meiyan"> | ||
| 194 | + </li> | ||
| 195 | + <li><img data-src="images/face/tiaoxie.gif" data-type="tiaoxie"> | ||
| 196 | + </li> | ||
| 197 | + <li><img data-src="images/face/yue.gif" data-type="yue"> | ||
| 198 | + </li> | ||
| 199 | + <li><img data-src="images/face/baoquan.gif" data-type="baoquan"> | ||
| 200 | + </li> | ||
| 201 | + <li><img data-src="images/face/fanu.gif" data-type="fanu"> | ||
| 202 | + </li> | ||
| 203 | + <li><img data-src="images/face/jingya.gif" data-type="jingya"> | ||
| 204 | + </li> | ||
| 205 | + <li><img data-src="images/face/mojing.gif" data-type="mojing"> | ||
| 206 | + </li> | ||
| 207 | + <li><img data-src="images/face/touxiao.gif" data-type="touxiao"> | ||
| 208 | + </li> | ||
| 209 | + <li><img data-src="images/face/yumen.gif" data-type="yumen"> | ||
| 210 | + </li> | ||
| 211 | + <li><img data-src="images/face/bishi.gif" data-type="bishi"> | ||
| 212 | + </li> | ||
| 213 | + <li><img data-src="images/face/fendou.gif" data-type="fendou"> | ||
| 214 | + </li> | ||
| 215 | + <li><img data-src="images/face/kafei.gif" data-type="kafei"> | ||
| 216 | + </li> | ||
| 217 | + <li><img data-src="images/face/piezui.gif" data-type="piezui"> | ||
| 218 | + </li> | ||
| 219 | + <li><img data-src="images/face/tu.gif" data-type="tu"> | ||
| 220 | + </li> | ||
| 221 | + <li><img data-src="images/face/yun.gif" data-type="yun"> | ||
| 222 | + </li> | ||
| 223 | + <li><img data-src="images/face/bizui.gif" data-type="bizui"> | ||
| 224 | + </li> | ||
| 225 | + <li><img data-src="images/face/ganga.gif" data-type="ganga"> | ||
| 226 | + </li> | ||
| 227 | + <li><img data-src="images/face/kelian.gif" data-type="kelian"> | ||
| 228 | + </li> | ||
| 229 | + </ul> | ||
| 230 | + <ul> | ||
| 231 | + <li><img data-src="images/face/pijiu.gif" data-type="pijiu"> | ||
| 232 | + </li> | ||
| 233 | + <li><img data-src="images/face/weiqu.gif" data-type="weiqu"> | ||
| 234 | + </li> | ||
| 235 | + <li><img data-src="images/face/zaijian.gif" data-type="zaijian"> | ||
| 236 | + </li> | ||
| 237 | + <li><img data-src="images/face/cahan.gif" data-type="cahan"> | ||
| 238 | + </li> | ||
| 239 | + <li><img data-src="images/face/guai.gif" data-type="guai"> | ||
| 240 | + </li> | ||
| 241 | + <li><img data-src="images/face/koubi.gif" data-type="koubi"> | ||
| 242 | + </li> | ||
| 243 | + <li><img data-src="images/face/qiang.gif" data-type="qiang"> | ||
| 244 | + </li> | ||
| 245 | + <li><img data-src="images/face/weixiao.gif" data-type="weixiao"> | ||
| 246 | + </li> | ||
| 247 | + <li><img data-src="images/face/zancheng.gif" data-type="zancheng"> | ||
| 248 | + </li> | ||
| 249 | + <li><img data-src="images/face/cool.gif" data-type="cool"> | ||
| 250 | + </li> | ||
| 251 | + <li><img data-src="images/face/guzhang.gif" data-type="guzhang"> | ||
| 252 | + </li> | ||
| 253 | + <li><img data-src="images/face/kuaikl.gif" data-type="kuaikl"> | ||
| 254 | + </li> | ||
| 255 | + <li><img data-src="images/face/qinqin.gif" data-type="qinqin"> | ||
| 256 | + </li> | ||
| 257 | + <li><img data-src="images/face/woshou.gif" data-type="woshou"> | ||
| 258 | + </li> | ||
| 259 | + <li><img data-src="images/face/zhemo.gif" data-type="zhemo"> | ||
| 260 | + </li> | ||
| 261 | + <li><img data-src="images/face/dabing.gif" data-type="dabing"> | ||
| 262 | + </li> | ||
| 263 | + <li><img data-src="images/face/hanxiao.gif" data-type="hanxiao"> | ||
| 264 | + </li> | ||
| 265 | + <li><img data-src="images/face/kulou.gif" data-type="kulou"> | ||
| 266 | + </li> | ||
| 267 | + <li><img data-src="images/face/qiu.gif" data-type="qiu"> | ||
| 268 | + </li> | ||
| 269 | + <li><img data-src="images/face/xigua.gif" data-type="xigua"> | ||
| 270 | + </li> | ||
| 271 | + <li><img data-src="images/face/zhouma.gif" data-type="zhouma"> | ||
| 272 | + </li> | ||
| 273 | + <li><img data-src="images/face/daku.gif" data-type="daku"> | ||
| 274 | + </li> | ||
| 275 | + <li><img data-src="images/face/haqi.gif" data-type="haqi"> | ||
| 276 | + </li> | ||
| 277 | + <li><img data-src="images/face/kun.gif" data-type="kun"> | ||
| 278 | + </li> | ||
| 279 | + <li><img data-src="images/face/ruo.gif" data-type="ruo"> | ||
| 280 | + </li> | ||
| 281 | + <li><img data-src="images/face/xin.gif" data-type="xin"> | ||
| 282 | + </li> | ||
| 283 | + <li><img data-src="images/face/zuohh.gif" data-type="zuohh"> | ||
| 284 | + </li> | ||
| 285 | + <li><img data-src="images/face/dangao.gif" data-type="dangao"> | ||
| 286 | + </li> | ||
| 287 | + <li><img data-src="images/face/hua.gif" data-type="hua"> | ||
| 288 | + </li> | ||
| 289 | + <li><img data-src="images/face/lianhong.gif" data-type="lianhong"> | ||
| 290 | + </li> | ||
| 291 | + <li><img data-src="images/face/shuai.gif" data-type="shuai"> | ||
| 292 | + </li> | ||
| 293 | + <li><img data-src="images/face/yinxian.gif" data-type="yinxian"> | ||
| 294 | + </li> | ||
| 295 | + </ul> | ||
| 296 | + </div> | ||
| 297 | + <div class="list_faces_paginator"> | ||
| 298 | + <b class="selected"></b> | ||
| 299 | + <b></b> | ||
| 300 | + </div> | ||
| 301 | + </div> | ||
| 302 | + <div class="dlg_login" | ||
| 303 | + style="display: none;"> | ||
| 304 | + <div class="masker"></div> | ||
| 305 | + <div class="dlg_inner"> | ||
| 306 | + <div class="dlg_title"> | ||
| 307 | + <p style="font-size: 22px; color: #fff;"> | ||
| 308 | + Welcome! | ||
| 309 | + </p> | ||
| 310 | + <p style="font-size: 12px; color: #ccc;"> | ||
| 311 | + 欢迎进入直播互动课堂 | ||
| 312 | + </p> | ||
| 313 | + </div> | ||
| 314 | + <div class="dlg_content"> | ||
| 315 | + <p class="txt_username"> | ||
| 316 | + <input type="text" class="form-control" placeholder="请输入您的姓名" maxlength="20" /> | ||
| 317 | + </p> | ||
| 318 | + <p class="txt_password"> | ||
| 319 | + <input type="text" class="form-control" placeholder="请输入课堂密码" maxlength="20" /> | ||
| 320 | + </p> | ||
| 321 | + <p> | ||
| 322 | + <button id="btn_login" class="btn_login"> | ||
| 323 | + 进入教室 | ||
| 324 | + </button> | ||
| 325 | + </p> | ||
| 326 | + </div> | ||
| 327 | + </div> | ||
| 328 | + </div> | ||
| 329 | + | ||
| 330 | + <div class="tip_panel" | ||
| 331 | + style="display: none;"> | ||
| 332 | + 用户名或者密码错误! | ||
| 333 | + </div> | ||
| 334 | + </div> | ||
| 335 | + | ||
| 336 | + <div class="tip_message" | ||
| 337 | + style="display: none;"></div> | ||
| 338 | + <div id="online_users" | ||
| 339 | + style="display: none;"> | ||
| 340 | + 0人在线 | ||
| 341 | + </div> | ||
| 342 | +</body> | ||
| 343 | + | ||
| 344 | +</html> |
package.json
0 → 100644
| 1 | +{ | ||
| 2 | + "name": "", | ||
| 3 | + "version": "1.0.1", | ||
| 4 | + "description": "McuClient on H5", | ||
| 5 | + "main": "dist/main.js", | ||
| 6 | + "directories": { | ||
| 7 | + "doc": "docs", | ||
| 8 | + "test": "test" | ||
| 9 | + }, | ||
| 10 | + "scripts": { | ||
| 11 | + "test": "test/index.js" | ||
| 12 | + }, | ||
| 13 | + "keywords": [ | ||
| 14 | + "LiveClass" | ||
| 15 | + ], | ||
| 16 | + "author": "www.3mang.com", | ||
| 17 | + "license": "MIT", | ||
| 18 | + "dependencies": { | ||
| 19 | + "base64-js": "^1.2.0", | ||
| 20 | + "es6-promise": "^3.2.1", | ||
| 21 | + "iscroll": "^5.2.0", | ||
| 22 | + "jquery": "^3.1.0", | ||
| 23 | + "jquery-touchswipe": "^1.6.15", | ||
| 24 | + "protobufjs": "^5.0.1", | ||
| 25 | + "string.fromcodepoint": "^0.2.1", | ||
| 26 | + "url-parse": "^1.1.1", | ||
| 27 | + "utf-8": "^1.0.0", | ||
| 28 | + "whatwg-fetch": "^1.0.0", | ||
| 29 | + "zlibjs": "^0.2.0" | ||
| 30 | + }, | ||
| 31 | + "wbp": { | ||
| 32 | + "project": "umd", | ||
| 33 | + "entries": { | ||
| 34 | + "main": "./MessageEngine.js" | ||
| 35 | + }, | ||
| 36 | + "source": "src/", | ||
| 37 | + "build": "dist/" | ||
| 38 | + } | ||
| 39 | +} |
src/Emiter.js
0 → 100644
| 1 | +export default class Emiter { | ||
| 2 | + constructor() { | ||
| 3 | + this.MAPS = {}; | ||
| 4 | + } | ||
| 5 | + on(eid, elistener) { | ||
| 6 | + if (eid && elistener) { | ||
| 7 | + let stub = this.MAPS[eid]; | ||
| 8 | + if (!stub) { | ||
| 9 | + return this.MAPS[eid] = [elistener]; | ||
| 10 | + } | ||
| 11 | + stub.push(elistener); | ||
| 12 | + } | ||
| 13 | + } | ||
| 14 | + off(eid, elistener) { | ||
| 15 | + if (eid) { | ||
| 16 | + let stub = this.MAPS[eid]; | ||
| 17 | + if (stub) { | ||
| 18 | + if (elistener) { | ||
| 19 | + return stub.splice(stub.indexOf(elistener), 1); | ||
| 20 | + } | ||
| 21 | + stub.length = 0; | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | + } | ||
| 25 | + emit(eid, data) { | ||
| 26 | + if (eid) { | ||
| 27 | + //eid=* broadcast | ||
| 28 | + let asteriskStub = this.MAPS['*']; | ||
| 29 | + if (asteriskStub && asteriskStub.length) { | ||
| 30 | + asteriskStub.forEach(function (elistener) { | ||
| 31 | + elistener(eid, data); | ||
| 32 | + }) | ||
| 33 | + } | ||
| 34 | + | ||
| 35 | + // eid= normal | ||
| 36 | + let stub = this.MAPS[eid]; | ||
| 37 | + if (stub && stub.length) { | ||
| 38 | + stub.forEach(function (elistener) { | ||
| 39 | + elistener(data); | ||
| 40 | + }); | ||
| 41 | + } | ||
| 42 | + } | ||
| 43 | + } | ||
| 44 | +} | ||
| 45 | + |
src/EverSocket.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present | ||
| 4 | +// All Rights Reserved. | ||
| 5 | +// | ||
| 6 | +// Author: AlexWang | ||
| 7 | +// Date: 2016-08-27 21:40:49 | ||
| 8 | +// Last Modified by: AlexWang | ||
| 9 | +// Last Modified time: 2016-12-05 12:02:48 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Description: 底层Socket管理器,保持一直在线及异常重连. | ||
| 12 | +// | ||
| 13 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 14 | + | ||
| 15 | +import Emiter from 'Emiter'; | ||
| 16 | +import Loger from 'Loger'; | ||
| 17 | +let loger = Loger.getLoger('EverSocket'); | ||
| 18 | + | ||
| 19 | +class EverSocket extends Emiter { | ||
| 20 | + constructor() { | ||
| 21 | + super(); | ||
| 22 | + this._connected = false; | ||
| 23 | + this._lastActiveTime = 0; | ||
| 24 | + this._enableEverSocket = false; | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | + begin(ip, port) { | ||
| 28 | + loger.log('开始WebSocket应用.'); | ||
| 29 | + this._enableEverSocket = true; | ||
| 30 | + this.wsURL = 'ws://' + ip + ':' + port; | ||
| 31 | + this._newConnection(); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + end() { | ||
| 35 | + loger.log('停止WebSocket应用.'); | ||
| 36 | + this._clear(); | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | + get connected() { | ||
| 40 | + return this._connected; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + send(data) { | ||
| 44 | + if (this._connected) { | ||
| 45 | + loger.log('SEND MESSAGE---->'); | ||
| 46 | + this.websocket.send(data); | ||
| 47 | + } else { | ||
| 48 | + loger.warn('WebSocket未建立连接.消息忽略'); | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + _setConnected(isConn = true) { | ||
| 53 | + this._connected = isConn; | ||
| 54 | + if (this._connected) { | ||
| 55 | + this.emit(EverSocket.OPEN); | ||
| 56 | + } else { | ||
| 57 | + this.emit(EverSocket.CLOSED); | ||
| 58 | + } | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + _newConnection() { | ||
| 62 | + this.websocket = new WebSocket(this.wsURL); | ||
| 63 | + this.websocket.binaryType = 'arraybuffer'; | ||
| 64 | + this.websocket.onopen = this._onOpen.bind(this); | ||
| 65 | + this.websocket.onclose = this._onClose.bind(this); | ||
| 66 | + this.websocket.onerror = this._onError.bind(this); | ||
| 67 | + this.websocket.onmessage = this._onMessage.bind(this); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + _reConnection() { | ||
| 71 | + this._clear(); | ||
| 72 | + this.reConnectionTimeout = window.setTimeout(() => { | ||
| 73 | + loger.log('WebSocket重新建立.'); | ||
| 74 | + window.clearTimeout(this.reConnectionTimeout); | ||
| 75 | + this._newConnection(); | ||
| 76 | + }, EverSocket.RECONN_INTERVAL); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + _clear() { | ||
| 80 | + loger.log('WebSocket,Timers销毁'); | ||
| 81 | + window.clearInterval(this.pingTimer); | ||
| 82 | + window.clearInterval(this.pongTimer); | ||
| 83 | + this.websocket.onopen = undefined; | ||
| 84 | + this.websocket.onclose = undefined; | ||
| 85 | + this.websocket.onerror = undefined; | ||
| 86 | + this.websocket.onmessage = undefined; | ||
| 87 | + try { | ||
| 88 | + this.websocket.close(); | ||
| 89 | + } catch (e) { | ||
| 90 | + loger.log('ignore errors'); | ||
| 91 | + } | ||
| 92 | + this.websocket = undefined; | ||
| 93 | + this._enableEverSocket = false; | ||
| 94 | + this._setConnected(false); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + _onOpen() { | ||
| 98 | + loger.log('WebSocket建立成功', this.wsURL); | ||
| 99 | + //this.pingTimer = window.setInterval(this._sendPingHandler.bind(this), EverSocket.PING_INTERVAL); | ||
| 100 | + //this.pongTimer = window.setInterval(this._checkPongHandler.bind(this), EverSocket.PONG_INTERVAL); | ||
| 101 | + this._setConnected(); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + _onClose(closeEvent) { | ||
| 105 | + loger.log(`WebSocket连接断开 CODE:${closeEvent.code} REASON:${closeEvent.reason} CLEAN: ${closeEvent.wasClean}`, this.wsURL); | ||
| 106 | + this._reConnection(); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + _onError() { | ||
| 110 | + loger.log('WebSocket错误出现'); | ||
| 111 | + this._connected = false; | ||
| 112 | + this._reConnection(); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + _onMessage(messageEvent) { | ||
| 116 | + loger.log('<----RECEIVE MESSAGE'); | ||
| 117 | + this._lastActiveTime = Date.now(); | ||
| 118 | + const bufferData = messageEvent.data; | ||
| 119 | + if (bufferData.byteLength > 0) { | ||
| 120 | + this.emit(EverSocket.MESSAGE, bufferData); | ||
| 121 | + } | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + _sendPingHandler() { | ||
| 125 | + if (this._connected) { | ||
| 126 | + this.websocket.send(new ArrayBuffer); | ||
| 127 | + } else { | ||
| 128 | + this._reConnection(); | ||
| 129 | + } | ||
| 130 | + } | ||
| 131 | + | ||
| 132 | + _checkPongHandler() { | ||
| 133 | + let pongTime = Date.now(); | ||
| 134 | + if (this._lastActiveTime && | ||
| 135 | + this._lastActiveTime >= pongTime - EverSocket.PONG_INTERVAL && | ||
| 136 | + this._lastActiveTime <= pongTime | ||
| 137 | + ) {} else { | ||
| 138 | + loger.warn('---服务器PINGPONG超时-----'); | ||
| 139 | + this._reConnection(); | ||
| 140 | + } | ||
| 141 | + } | ||
| 142 | +} | ||
| 143 | + | ||
| 144 | +EverSocket.prototype.PONG_INTERVAL = EverSocket.PONG_INTERVAL = 5000; | ||
| 145 | +EverSocket.prototype.PING_INTERVAL = EverSocket.PING_INTERVAL = 3000; | ||
| 146 | +EverSocket.prototype.RECONN_INTERVAL = EverSocket.RECONN_INTERVAL = 2000; | ||
| 147 | +EverSocket.prototype.CONNECTING = EverSocket.CONNECTING = 0; | ||
| 148 | +EverSocket.prototype.OPEN = EverSocket.OPEN = 1; | ||
| 149 | +EverSocket.prototype.CLOSING = EverSocket.CLOSING = 2; | ||
| 150 | +EverSocket.prototype.CLOSED = EverSocket.CLOSED = 3; | ||
| 151 | +EverSocket.prototype.MESSAGE = EverSocket.MESSAGE = 4; | ||
| 152 | + | ||
| 153 | +export default new EverSocket(); | ||
| 154 | + |
src/Loger.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-27 22:58:47 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2016-08-27 23:05:53 | ||
| 12 | +// Description: LiveClass-Loger | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | + | ||
| 16 | +class Loger { | ||
| 17 | + constructor(info) { | ||
| 18 | + this.info = info || ''; | ||
| 19 | + this.id = this.initId(); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + initId() { | ||
| 23 | + const infoType = this.info.constructor.name.toLowerCase(); | ||
| 24 | + if (infoType === 'string') { | ||
| 25 | + return this.info; | ||
| 26 | + } | ||
| 27 | + if (infoType === 'object') { | ||
| 28 | + return this.info.mid || ''; | ||
| 29 | + } | ||
| 30 | + return ''; | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | + log(...msg) { | ||
| 34 | + this._log(Loger.LOG, msg); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + warn(...msg) { | ||
| 38 | + this._log(Loger.WARN, msg); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + error(...msg) { | ||
| 42 | + this._log(Loger.ERROR, msg); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + _log(type, msg) { | ||
| 46 | + msg = JSON.stringify(msg); | ||
| 47 | + | ||
| 48 | + let logMsg = `${this.id} -> ${msg}`; | ||
| 49 | + if (type >= Loger.logLevel) { | ||
| 50 | + switch (type) { | ||
| 51 | + case Loger.LOG: | ||
| 52 | + console.log(logMsg); | ||
| 53 | + break; | ||
| 54 | + case Loger.WARN: | ||
| 55 | + console.warn(logMsg); | ||
| 56 | + break; | ||
| 57 | + case Loger.ERROR: | ||
| 58 | + console.error(logMsg); | ||
| 59 | + break; | ||
| 60 | + } | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | +} | ||
| 64 | + | ||
| 65 | +Loger.LOG = 0; | ||
| 66 | +Loger.WARN = 1; | ||
| 67 | +Loger.ERROR = 2; | ||
| 68 | +Loger.NO = Infinity; | ||
| 69 | +Loger.logLevel = Loger.LOG; | ||
| 70 | + | ||
| 71 | +export default { | ||
| 72 | + getLoger: function getLoger(info) { | ||
| 73 | + return new Loger(info); | ||
| 74 | + }, | ||
| 75 | + setLogLevel: function setLogLevel(logLevel) { | ||
| 76 | + Loger.logLevel = logLevel; | ||
| 77 | + }, | ||
| 78 | + LOG: Loger.LOG, | ||
| 79 | + WARN: Loger.WARN, | ||
| 80 | + ERROR: Loger.ERROR, | ||
| 81 | + NO: Loger.NO, | ||
| 82 | +}; | ||
| 83 | + |
src/MessageEngine.js
0 → 100644
| 1 | +import Emiter from './Emiter'; | ||
| 2 | +import h5Sass from 'Sass'; | ||
| 3 | +import mcu from 'mcu'; | ||
| 4 | +import MessageTypes from 'MessageTypes'; | ||
| 5 | +import Loger from 'Loger'; | ||
| 6 | +import ConferApe from 'apes/ConferApe'; | ||
| 7 | +import ChatApe from 'apes/ChatApe'; | ||
| 8 | +import VideoChat from 'apes/VideoApe'; | ||
| 9 | +import DocApe from 'apes/DocApe'; | ||
| 10 | +import WhiteBoardApe from 'apes/WhiteBoardApe'; | ||
| 11 | + | ||
| 12 | +let loger = Loger.getLoger('MessageEngine'); | ||
| 13 | + | ||
| 14 | +export default class MessageEngine extends Emiter { | ||
| 15 | + constructor() { | ||
| 16 | + super(); | ||
| 17 | + | ||
| 18 | + // 应用层会议信息 | ||
| 19 | + this.confInfo = null; | ||
| 20 | + | ||
| 21 | + // Sass平台层 | ||
| 22 | + this.h5Sass = h5Sass; | ||
| 23 | + this.h5Sass.on('*', (type, data) => this.emit(type, data)); | ||
| 24 | + this.h5Sass.on(h5Sass.SUCCESS, this._h5SassSuccessHandler.bind(this)); | ||
| 25 | + | ||
| 26 | + // 底层MCU消息层 | ||
| 27 | + this.mcu = mcu; | ||
| 28 | + this.mcu.on('*', (type, data) => this.emit(type, data)); | ||
| 29 | + this.mcu.on(MessageTypes.CONFERENCE_JOIN_SUCCESS, this._conferenceJoinSuccessHandler.bind(this)); | ||
| 30 | + | ||
| 31 | + // 注册所有应用Ape | ||
| 32 | + this.conferApe = new ConferApe(); | ||
| 33 | + this.conferApe.on('*', (type, data) => this.emit(type, data)); | ||
| 34 | + this.conferApe.on(MessageTypes.DOC_SWITCH, this.docSwitchHandler.bind(this)); | ||
| 35 | + | ||
| 36 | + this.chat_ape = new ChatApe(); | ||
| 37 | + this.chat_ape.on('*', (type, data) => this.emit(type, data)); | ||
| 38 | + | ||
| 39 | + this.video_ape = new VideoChat(); | ||
| 40 | + this.video_ape.on('*', (type, data) => this.emit(type, data)); | ||
| 41 | + | ||
| 42 | + this.doc_ape = new DocApe(); | ||
| 43 | + this.doc_ape.on('*', (type, data) => this.emit(type, data)); | ||
| 44 | + this.doc_ape.on(MessageTypes.DOC_UPDATE, this.docUpdateHandler.bind(this)); | ||
| 45 | + | ||
| 46 | + this.doc_ape.on(MessageTypes.DOC_DEL, this.docDeleteHandler.bind(this)); | ||
| 47 | + | ||
| 48 | + this.wb_ape = new WhiteBoardApe(); | ||
| 49 | + this.wb_ape.on('*', (type, data) => this.emit(type, data)); | ||
| 50 | + this.wb_ape.on(MessageTypes.ANNO_UPDATE, this.annoUpdateHandler.bind(this)); | ||
| 51 | + | ||
| 52 | + this.on(MessageTypes.DOC_SHOW, this.docShowHandler.bind(this)); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + // 白板笔记更新 | ||
| 56 | + annoUpdateHandler(annoInfo) { | ||
| 57 | + const activeDocId = this.conferApe.activeDocId; | ||
| 58 | + const docItem = this.doc_ape.docList[activeDocId]; | ||
| 59 | + if (docItem && annoInfo.id == docItem.wbid) { | ||
| 60 | + this.emit(MessageTypes.DOC_ANNO, annoInfo); | ||
| 61 | + } | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + // 文档变更-笔记处理 | ||
| 65 | + docShowHandler(docItem) { | ||
| 66 | + loger.log('Doc Show ->' + docItem.id + '|' + docItem.curPageNo); | ||
| 67 | + | ||
| 68 | + const annoInfo = this.wb_ape.annoInfos[docItem.wbid]; | ||
| 69 | + if (annoInfo) { | ||
| 70 | + this.emit(MessageTypes.DOC_ANNO, annoInfo); | ||
| 71 | + } else { | ||
| 72 | + this.emit(MessageTypes.DOC_ANNO); | ||
| 73 | + | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + } | ||
| 77 | + | ||
| 78 | + // 文档切换 | ||
| 79 | + docSwitchHandler() { | ||
| 80 | + const activeDocId = this.conferApe.activeDocId; | ||
| 81 | + loger.log('Switch Doc Active -> ' + activeDocId); | ||
| 82 | + const docItem = this.doc_ape.docList[activeDocId]; | ||
| 83 | + if (docItem) { | ||
| 84 | + this.emit(MessageTypes.DOC_SHOW, docItem); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + // 文档变更 | ||
| 89 | + docUpdateHandler(docItem) { | ||
| 90 | + loger.log('Doc UpdateId ->' + docItem.id + '| activeDocId ->' + this.conferApe.activeDocId); | ||
| 91 | + if (docItem.id == this.conferApe.activeDocId) { | ||
| 92 | + this.emit(MessageTypes.DOC_SHOW, docItem); | ||
| 93 | + } | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + //文档删除 | ||
| 97 | + docDeleteHandler(docItem){ | ||
| 98 | + if (docItem.id == this.conferApe.activeDocId) { | ||
| 99 | + this.emit(MessageTypes.DOC_DEL, docItem); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + | ||
| 104 | + // MCU 会议成功 | ||
| 105 | + _conferenceJoinSuccessHandler() { | ||
| 106 | + this.h5Sass.getClassDetail(); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + // 通过SASS平台验证 | ||
| 110 | + _h5SassSuccessHandler() { | ||
| 111 | + loger.log('加入底层MCU会议.'); | ||
| 112 | + this.mcu.joinMCU(this.confInfo); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + // 进入会议 | ||
| 116 | + joinClass(_confInfo) { | ||
| 117 | + this.confInfo = _confInfo; | ||
| 118 | + this.h5Sass.sassChecking(_confInfo); | ||
| 119 | + } | ||
| 120 | + | ||
| 121 | + // 离开会议 | ||
| 122 | + leaveClass() { | ||
| 123 | + this.mcu.leaveMCU(); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + // 参会处理 | ||
| 127 | + conferenceHandler(msg_type) { | ||
| 128 | + var msg = { | ||
| 129 | + type: msg_type, | ||
| 130 | + data: null | ||
| 131 | + }; | ||
| 132 | + this.emit(msg.type, msg); | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + // 发送聊天消息 | ||
| 136 | + sendChatMsg(to, msg) { | ||
| 137 | + if (this.chat_ape) { | ||
| 138 | + this.chat_ape.sendChatMsg(to, msg); | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | +} | ||
| 142 | + | ||
| 143 | +MessageEngine.MESSAGE_DELAY_TIMMER = 100; | ||
| 144 | + |
src/MessageTypes.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-27 23:04:56 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2016-09-07 15:58:29 | ||
| 12 | +// Description: LiveClass-MessageTypes | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | + | ||
| 16 | +function MessageTypes() {} | ||
| 17 | + | ||
| 18 | +MessageTypes.CONFERENCE_SHOW_USERNAME = 'show.name.input'; | ||
| 19 | +MessageTypes.CONFERENCE_SHOW_ILLEGAL = 'illegal.user'; | ||
| 20 | +MessageTypes.CONFERENCE_SHOW_USERNAME_PASSWORD = 'show.name.pasword.input'; | ||
| 21 | +MessageTypes.CONFERENCE_SHOW_WRONG_PASSWORD = 'password.wrong'; | ||
| 22 | +MessageTypes.CONFERENCE_JOIN_FAILED = 'join.conference.failed'; | ||
| 23 | +MessageTypes.CONFERENCE_JOIN_SUCCESS = 'join.conference.success'; | ||
| 24 | +MessageTypes.CONFERENCE_JOIN_FULL = 'full.capacity'; | ||
| 25 | +MessageTypes.CONFERENCE_EXIT = 'conference.exit'; | ||
| 26 | +MessageTypes.CONFERENCE_JOIN_CONFILICT = 'have.been.logged.elsewhere'; | ||
| 27 | +MessageTypes.CONFERENCE_SHOW_DETAIL = 'class_detail.message'; | ||
| 28 | +MessageTypes.CONFERENCE_SHOW_ROSTER_NUM = 'roster_num.message'; | ||
| 29 | + | ||
| 30 | +MessageTypes.NET_ERROR = 'net_error'; | ||
| 31 | +MessageTypes.PRO_ERROR = 'pro_error'; | ||
| 32 | + | ||
| 33 | +MessageTypes.VIDEO_SHOW = 'video.message'; | ||
| 34 | +MessageTypes.DOC_SHOW = 'document.message'; | ||
| 35 | +MessageTypes.DOC_SWITCH = 'document.switch'; | ||
| 36 | +MessageTypes.DOC_UPDATE = 'document.update'; | ||
| 37 | +MessageTypes.CHAT_RECEIVE = 'chat.message'; | ||
| 38 | +MessageTypes.DOC_ANNO = 'document.anno'; | ||
| 39 | +MessageTypes.ANNO_UPDATE = 'anno_update'; | ||
| 40 | + | ||
| 41 | +MessageTypes.DOC_DEL='document.delete'; | ||
| 42 | +MessageTypes.AUDIO_SHOW='audio.message'; | ||
| 43 | + | ||
| 44 | + | ||
| 45 | +export default MessageTypes; | ||
| 46 | + |
src/Sass.js
0 → 100644
| 1 | +import Emiter from 'Emiter'; | ||
| 2 | +import Loger from 'Loger'; | ||
| 3 | +import MessageTypes from 'MessageTypes'; | ||
| 4 | + | ||
| 5 | +// 日志对象 | ||
| 6 | +const loger = Loger.getLoger('H5Sass'); | ||
| 7 | + | ||
| 8 | +let confInfo = {}; | ||
| 9 | +class H5Sass extends Emiter { | ||
| 10 | + constructor() { | ||
| 11 | + super(); | ||
| 12 | + } | ||
| 13 | + | ||
| 14 | + // Sass校验 | ||
| 15 | + sassChecking(_confInfo) { | ||
| 16 | + loger.log('发起Sass校验', _confInfo); | ||
| 17 | + this.confInfo = _confInfo; | ||
| 18 | + | ||
| 19 | + // 密码校验 | ||
| 20 | + if (this.confInfo.nopassword === 'true') { | ||
| 21 | + return this.sendPWDChecking(); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + // MD5校验 | ||
| 25 | + this.sendMD5Checking(); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + // 入会校验 | ||
| 29 | + sendPWDChecking() { | ||
| 30 | + let url = `http://${this.confInfo.portal}/3m/getCheckMeetinig.do?siteId=${this.confInfo.siteId}&classId=${this.confInfo.confId}&password=${this.confInfo.password}`; | ||
| 31 | + loger.log('会议密码校验', url); | ||
| 32 | + fetch(url, { | ||
| 33 | + timeout: 5000 | ||
| 34 | + }) | ||
| 35 | + .then(ret => { | ||
| 36 | + if (ret.status === 200) { | ||
| 37 | + return ret.text(); | ||
| 38 | + } else { | ||
| 39 | + loger.error(`会议密码校验-网络异常.状态码:${ret.status}`); | ||
| 40 | + this.emit(MessageTypes.NET_ERROR); | ||
| 41 | + throw ''; | ||
| 42 | + } | ||
| 43 | + }) | ||
| 44 | + .then(ret => { | ||
| 45 | + if (ret === 'false') { | ||
| 46 | + loger.error(`会议密码校验-失败.`); | ||
| 47 | + return this.emit(MessageTypes.CONFERENCE_SHOW_WRONG_PASSWORD); | ||
| 48 | + } | ||
| 49 | + if (ret === 'true') { | ||
| 50 | + loger.log(`会议密码校验-成功.`); | ||
| 51 | + this.sendMD5Checking(); | ||
| 52 | + return | ||
| 53 | + } | ||
| 54 | + loger.error(`会议密码校验-协议异常.`); | ||
| 55 | + this.emit(MessageTypes.PRO_ERROR); | ||
| 56 | + }) | ||
| 57 | + .catch(err => { | ||
| 58 | + loger.error(`会议密码校验-异常.状态码:${err}`); | ||
| 59 | + this.emit(MessageTypes.NET_ERROR); | ||
| 60 | + }); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + // 发起入会 | ||
| 64 | + sendMD5Checking() { | ||
| 65 | + let url = `http://${this.confInfo.portal}/3m/meeting/md5CheckMeeting.do?siteId=${this.confInfo.siteId}&meetingNumber=${this.confInfo.confId}&userId=${this.confInfo.userId}&userName=${this.confInfo.userName}&userType=${this.confInfo.userType}&nopassword=${this.confInfo.nopassword}&md5=${this.confInfo.md5}`; | ||
| 66 | + | ||
| 67 | + loger.log('H5SassMD5校验', url); | ||
| 68 | + | ||
| 69 | + fetch(url, { | ||
| 70 | + timeout: 5000 | ||
| 71 | + }) | ||
| 72 | + .then(ret => { | ||
| 73 | + if (ret.status === 200) { | ||
| 74 | + return ret.json(); | ||
| 75 | + } else { | ||
| 76 | + loger.error(`H5SassMD5校验-网络异常.状态码:${ret.status}`); | ||
| 77 | + this.emit(MessageTypes.NET_ERROR); | ||
| 78 | + throw ''; | ||
| 79 | + } | ||
| 80 | + }) | ||
| 81 | + .then(ret => { | ||
| 82 | + if (ret.flag == "true") { | ||
| 83 | + if (ret.h5_mcu_list) { | ||
| 84 | + let server = ret.h5_mcu_list.split(";")[0]; | ||
| 85 | + this.confInfo.MCUServerIP = server.split(":")[0]; | ||
| 86 | + this.confInfo.MCUServerPort = server.split(":")[1]; | ||
| 87 | + } | ||
| 88 | + this.confInfo.maxVideoChannels = ret.maxVideoChannels; | ||
| 89 | + this.confInfo.maxAudioChannels = ret.maxAudioChannels; | ||
| 90 | + this.confInfo.maxMediaChannels = this.confInfo.maxVideoChannels + this.confInfo.maxAudioChannels; | ||
| 91 | + loger.log('H5Sass校验完成'); | ||
| 92 | + this.emit(H5Sass.SUCCESS); | ||
| 93 | + } else { | ||
| 94 | + loger.log('H5SassMD5校验-失败.'); | ||
| 95 | + this.emit(MessageTypes.CONFERENCE_JOIN_FAILED); | ||
| 96 | + } | ||
| 97 | + }) | ||
| 98 | + .catch(err => { | ||
| 99 | + loger.error(`H5SassMD5校验-异常.状态码:${err}`); | ||
| 100 | + this.emit(MessageTypes.NET_ERROR); | ||
| 101 | + }); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + // 获取会议详情 | ||
| 105 | + getClassDetail() { | ||
| 106 | + let url = `http://${this.confInfo.portal}/3m/meeting/getClassH5.do?classNumber=${this.confInfo.confId}`; | ||
| 107 | + | ||
| 108 | + loger.log('H5Sass获取Class详情.', url); | ||
| 109 | + | ||
| 110 | + fetch(url, { | ||
| 111 | + timeout: 5000 | ||
| 112 | + }) | ||
| 113 | + .then(ret => { | ||
| 114 | + if (ret.ok) { | ||
| 115 | + return ret.json(); | ||
| 116 | + } else { | ||
| 117 | + loger.error(`H5Sass获取Class详情-网络异常.状态码:${ret.status}`); | ||
| 118 | + this.emit(MessageTypes.NET_ERROR); | ||
| 119 | + throw ''; | ||
| 120 | + } | ||
| 121 | + }) | ||
| 122 | + .then(ret => { | ||
| 123 | + if (ret.errorCode === 0) { | ||
| 124 | + loger.log('H5Sass获取Class详情完成'); | ||
| 125 | + this.emit(MessageTypes.CONFERENCE_SHOW_DETAIL, ret); | ||
| 126 | + } else { | ||
| 127 | + loger.warn('H5Sass获取Class详情失败.'); | ||
| 128 | + this.emit(MessageTypes.NET_ERROR); | ||
| 129 | + } | ||
| 130 | + }) | ||
| 131 | + .catch(err => { | ||
| 132 | + loger.error(`H5Sass获取Class详情异常.状态码:${err}`); | ||
| 133 | + this.emit(MessageTypes.NET_ERROR); | ||
| 134 | + }); | ||
| 135 | + } | ||
| 136 | +} | ||
| 137 | + | ||
| 138 | +H5Sass.prototype.SUCCESS = H5Sass.SUCCESS = 'h5sass.success'; | ||
| 139 | + | ||
| 140 | +export default new H5Sass; | ||
| 141 | + |
src/apes/Ape.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-26 11:19:56 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2017-01-04 14:38:20 | ||
| 12 | +// Description: LiveClass-Ape | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | + | ||
| 16 | +import pdu from 'pdu'; | ||
| 17 | +import Emiter from 'Emiter'; | ||
| 18 | +import mcu from 'mcu'; | ||
| 19 | +import Loger from 'Loger'; | ||
| 20 | +import MessageTypes from 'MessageTypes'; | ||
| 21 | +import ApeConsts from './ApeConsts'; | ||
| 22 | +import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | ||
| 23 | +import PduConsts from 'pdu/PduConsts'; | ||
| 24 | + | ||
| 25 | +// 日志对象 | ||
| 26 | +const loger = Loger.getLoger('Ape'); | ||
| 27 | + | ||
| 28 | +export default class Ape extends Emiter { | ||
| 29 | + constructor( | ||
| 30 | + session_id, | ||
| 31 | + session_name, | ||
| 32 | + session_tag | ||
| 33 | + ) { | ||
| 34 | + super(); | ||
| 35 | + this._session_id = session_id; | ||
| 36 | + this._channel_id = session_id; // session_id === channel_id | ||
| 37 | + this._session_name = session_name; | ||
| 38 | + this._session_tag = session_tag; | ||
| 39 | + this._session_channels = {}; | ||
| 40 | + this._adapter_pdu = new pdu['RCAdapterPdu']; | ||
| 41 | + this._confInfo = null; | ||
| 42 | + this._rCArrayBufferUtil = ArrayBufferUtil; | ||
| 43 | + this._apeDelayed = false; | ||
| 44 | + this._apeDelayedMsgs = []; | ||
| 45 | + this._apeDelayedTimer = 0; | ||
| 46 | + | ||
| 47 | + //Ape 通用消息处理 | ||
| 48 | + this.on(pdu.RCPDU_SESSION_JOIN_RESPONSE, this._joinSessionHandler.bind(this)); | ||
| 49 | + this.on(pdu.RCPDU_CHANNEL_JOIN_RESPONSE, this._joinChannelHandler.bind(this)); | ||
| 50 | + this.on(pdu.RCPDU_REG_ADAPTER, this._pduMessageHandler.bind(this)); | ||
| 51 | + | ||
| 52 | + // 监听底层MCU会议 | ||
| 53 | + this.mcu = mcu; | ||
| 54 | + this.mcu.on(MessageTypes.CONFERENCE_JOIN_SUCCESS, this._mcuConferenceJoinSuccessHandler.bind(this)); | ||
| 55 | + this.mcu.registerApe(this); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + regResponsePduHandler() { | ||
| 59 | + | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + // 消息处理 | ||
| 63 | + _pduMessageHandler(regBuffer) { | ||
| 64 | + if (this._apeDelayed) { | ||
| 65 | + // this._apeDelayedMsgs.push(regBuffer); | ||
| 66 | + // this._apeDelayedStart(); | ||
| 67 | + setTimeout(() => { | ||
| 68 | + this._pduRegAdapterHandler(regBuffer); | ||
| 69 | + }, this._confInfo['mcuDelay'] || 12000); | ||
| 70 | + return; | ||
| 71 | + } | ||
| 72 | + this._pduRegAdapterHandler(regBuffer); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + // _apeDelayedStart() { | ||
| 76 | + // if (this._apeDelayed && !this._apeDelayedTimer) { | ||
| 77 | + // this._apeDelayedTimer = setInterval(this._delayedMsgHandler.bind(this), this._confInfo['mcuDelay'] || 10000); | ||
| 78 | + // } | ||
| 79 | + // } | ||
| 80 | + | ||
| 81 | + // _apeDelayedStop() { | ||
| 82 | + // clearInterval(this._apeDelayedTimer); | ||
| 83 | + // this._apeDelayedTimer = 0; | ||
| 84 | + // } | ||
| 85 | + | ||
| 86 | + // // 延迟消息处理 | ||
| 87 | + // _delayedMsgHandler() { | ||
| 88 | + // if (this._apeDelayedMsgs.length) { | ||
| 89 | + // this._pduRegAdapterHandler(this._apeDelayedMsgs.pop()); | ||
| 90 | + // if (!this._apeDelayedMsgs.length) this._apeDelayedStop(); | ||
| 91 | + // } | ||
| 92 | + // } | ||
| 93 | + | ||
| 94 | + // 数据同步处理 | ||
| 95 | + _pduRegAdapterHandler(regBuffer) { | ||
| 96 | + let regPdu = pdu['RCAdapterPdu'].decode(regBuffer); | ||
| 97 | + let regItems = regPdu.item; | ||
| 98 | + let regItemSize = regItems.length; | ||
| 99 | + | ||
| 100 | + loger.log(this._session_name + '数据同步消息.同步条数', regItemSize); | ||
| 101 | + | ||
| 102 | + for (var i = 0; i < regItemSize; ++i) { | ||
| 103 | + let regItem = regItems[i]; | ||
| 104 | + let regItemType = regItem.type; | ||
| 105 | + let regItemData = regItem.itemData; | ||
| 106 | + | ||
| 107 | + if (pdu.RCPDU_REG_UPDATE_OBJ !== regItemType) { | ||
| 108 | + if (pdu.RCPDU_REG_RESPONSE_OBJ == regItemType) { | ||
| 109 | + let regResponsePdu = pdu['RCRegistryResponseObjPdu'].decode(regItemData); | ||
| 110 | + this.regResponsePduHandler(regResponsePdu); | ||
| 111 | + } | ||
| 112 | + // 只处理两种类型 | ||
| 113 | + continue; | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + let regUpdatedItem = pdu['RCRegistryUpdateObjPdu'].decode(regItemData); | ||
| 117 | + let sub_type = regUpdatedItem.subType; | ||
| 118 | + let object_id = regUpdatedItem.objId; | ||
| 119 | + let user_data = regUpdatedItem.userData; | ||
| 120 | + | ||
| 121 | + loger.log('REG OBJECT EVENT ->', pdu.id2type(sub_type)); | ||
| 122 | + switch (sub_type) { | ||
| 123 | + case pdu.RCPDU_REG_ROSTER_INSERT_PDU: | ||
| 124 | + let rosterInsertData = pdu['RCRegstryRosterInsertItemPdu'].decode(user_data); | ||
| 125 | + let rosterInsertItems = rosterInsertData.items; | ||
| 126 | + let rosterInsertItemsLen = rosterInsertItems.length; | ||
| 127 | + for (let i = 0; i < rosterInsertItemsLen; ++i) { | ||
| 128 | + let record = rosterInsertItems[i]; | ||
| 129 | + let recordId = record.item_id; | ||
| 130 | + let recordData = pdu['RCNodeInfoRecordPdu'].decode(record.item_data); | ||
| 131 | + this.rosterInsertHandler(recordId, recordData); | ||
| 132 | + } | ||
| 133 | + break; | ||
| 134 | + case pdu.RCPDU_REG_ROSTER_DELETE_PDU: | ||
| 135 | + let rosterDelData = pdu['RCRegistryRosterDeleteItemPdu'].decode(user_data); | ||
| 136 | + this.rosterDelHandler(rosterDelData.nodeId); | ||
| 137 | + break; | ||
| 138 | + case pdu.RCPDU_REG_ROSTER_UPDATE_PDU: | ||
| 139 | + let rosterUpdateData = pdu['RCRegistryRosterUpdateItemPdu'].decode(user_data); | ||
| 140 | + let rosterUpdateItems = rosterUpdateData.items; | ||
| 141 | + let rosterUpdateItemsLen = rosterUpdateItems.length; | ||
| 142 | + for (let i = 0; i < rosterUpdateItemsLen; ++i) { | ||
| 143 | + let node = rosterUpdateItems[i]; | ||
| 144 | + let nodeId = node.nodeId; | ||
| 145 | + let nodeData = pdu['RCNodeInfoRecordPdu'].decode(node.nodeData); | ||
| 146 | + this.rosterUpdateHandler(nodeId, nodeData); | ||
| 147 | + } | ||
| 148 | + break; | ||
| 149 | + case pdu.RCPDU_REG_TABLE_INSERT_PDU: | ||
| 150 | + let tableInsertData = pdu['RCRegistryTableInsertItemPdu'].decode(user_data); | ||
| 151 | + let tableInsertItems = tableInsertData.items; | ||
| 152 | + let tableInsertItemsLen = tableInsertItems.length; | ||
| 153 | + for (let i = 0; i < tableInsertItemsLen; ++i) { | ||
| 154 | + let insertItem = tableInsertItems[i]; | ||
| 155 | + this.tableInsertHandler(insertItem.owner, insertItem.itemIdx, insertItem.itemData); | ||
| 156 | + } | ||
| 157 | + break; | ||
| 158 | + case pdu.RCPDU_REG_TABLE_DELETE_PDU: | ||
| 159 | + let tableDeleteData = pdu['RCRegistryTableDeleteItemPdu'].decode(user_data); | ||
| 160 | + this.tableDeleteHandler(object_id, tableDeleteData); | ||
| 161 | + break; | ||
| 162 | + case pdu.RCPDU_REG_TABLE_UPDATE_PDU: | ||
| 163 | + let tableUpdateData = pdu['RCRegistryTableUpdateItemPdu'].decode(user_data); | ||
| 164 | + let tableUpdateItems = tableUpdateData.items; | ||
| 165 | + let tableUpdateItemsLen = tableUpdateItems.length; | ||
| 166 | + for (let i = 0; i < tableUpdateItemsLen; ++i) { | ||
| 167 | + let tableItem = tableUpdateItems[i]; | ||
| 168 | + this.tableUpdateHandler(tableItem.owner, tableItem.itemIdx, tableItem.itemData); | ||
| 169 | + } | ||
| 170 | + break; | ||
| 171 | + case pdu.RCPDU_REG_QUEUE_UPDATE_PDU: | ||
| 172 | + case pdu.RCPDU_REG_QUEUE_DELETE_PDU: | ||
| 173 | + case pdu.RCPDU_REG_QUEUE_INSERT_PDU: | ||
| 174 | + loger.warn('REG QUEUE ARE IGNORED'); | ||
| 175 | + break; | ||
| 176 | + | ||
| 177 | + } | ||
| 178 | + } | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + rosterInsertHandler(recordId, recordData) { | ||
| 182 | + loger.warn(this._session_name + ' rosterInsertHandler 应有子类具体覆盖处理.'); | ||
| 183 | + } | ||
| 184 | + rosterUpdateHandler(nodeId, nodeData) { | ||
| 185 | + loger.warn(this._session_name + ' rosterUpdateHandler 应有子类具体覆盖处理.'); | ||
| 186 | + } | ||
| 187 | + rosterDelHandler(recordData) { | ||
| 188 | + loger.warn(this._session_name + ' rosterDelHandler 应有子类具体覆盖处理.'); | ||
| 189 | + } | ||
| 190 | + tableInsertHandler(tableId, record) { | ||
| 191 | + loger.warn(this._session_name + ' tableInsertHandler 应有子类具体覆盖处理.'); | ||
| 192 | + } | ||
| 193 | + tableUpdateHandler(ownerId, recordId, recordData) { | ||
| 194 | + loger.warn(this._session_name + ' tableUpdateHandler 应有子类具体覆盖处理.'); | ||
| 195 | + } | ||
| 196 | + tableDeleteHandler(tableId, record) { | ||
| 197 | + loger.warn(this._session_name + ' tableDelHandler 应有子类具体覆盖处理.'); | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + // 加入Session处理 | ||
| 201 | + _joinSessionHandler(data) { | ||
| 202 | + loger.log(this._session_name, ' -> 加入Session'); | ||
| 203 | + } | ||
| 204 | + | ||
| 205 | + // 加入Channel处理 | ||
| 206 | + _joinChannelHandler(data) { | ||
| 207 | + let joinedChannel = pdu['RCChannelJoinResponsePdu'].decode(data); | ||
| 208 | + if (joinedChannel.result === pdu.RET_SUCCESS) { | ||
| 209 | + loger.log(this._session_name, ' -> 加入Channel成功. ChannelId', joinedChannel.requestedChannelId); | ||
| 210 | + this._session_channels[joinedChannel.requestedChannelId] = ApeConsts.CJS_JOINNED; | ||
| 211 | + } else { | ||
| 212 | + loger.log(this._session_name, ' -> 加入Channel失败.', joinedChannel); | ||
| 213 | + } | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + // 依赖的会议创建完毕 - 发起Ape加入 | ||
| 217 | + _mcuConferenceJoinSuccessHandler(confInfo) { | ||
| 218 | + loger.log('创建Ape->', | ||
| 219 | + 'SessionId', | ||
| 220 | + this._session_id, | ||
| 221 | + 'SessionName', | ||
| 222 | + this._session_name, | ||
| 223 | + 'SessionTag', | ||
| 224 | + this._session_tag); | ||
| 225 | + | ||
| 226 | + // 会议依赖底层会议信息 | ||
| 227 | + this._confInfo = confInfo; | ||
| 228 | + | ||
| 229 | + var joinSessionPdu = new pdu['RCSessionJoinRequestPdu']; | ||
| 230 | + joinSessionPdu.id = this._session_id; | ||
| 231 | + joinSessionPdu.name = this._session_name; | ||
| 232 | + joinSessionPdu.tag = this._session_tag; | ||
| 233 | + joinSessionPdu.sessionData = this._adapter_pdu.toArrayBuffer(); | ||
| 234 | + this.sendUniform(joinSessionPdu, true); | ||
| 235 | + | ||
| 236 | + var joinChannelPdu = new pdu['RCChannelJoinRequestPdu']; | ||
| 237 | + joinChannelPdu.initiator = this.mcu.confInfo.nodeId; | ||
| 238 | + joinChannelPdu.channelId = this._session_id; | ||
| 239 | + this.send(joinChannelPdu); | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + // 注册Key对象 | ||
| 243 | + registerKey(id, name, tag, user_data) { | ||
| 244 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 245 | + adapterItemPdu.type = pdu.RCPDU_REG_REGISTER_KEY; | ||
| 246 | + | ||
| 247 | + // pack register key pdu | ||
| 248 | + let registerKeyPdu = new pdu['RCRegistryRegisterKeyPdu']; | ||
| 249 | + registerKeyPdu.id = id; | ||
| 250 | + registerKeyPdu.name = name; | ||
| 251 | + registerKeyPdu.tag = tag; | ||
| 252 | + if (user_data.length) { | ||
| 253 | + registerKeyPdu.userData = user_data; | ||
| 254 | + } | ||
| 255 | + | ||
| 256 | + adapterItemPdu.itemData = registerKeyPdu.toArrayBuffer(); | ||
| 257 | + this._adapter_pdu.item.push(adapterItemPdu); | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + // 注册Object对象 | ||
| 261 | + registerObj(type, id, name, tag, owner, user_data) { | ||
| 262 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 263 | + adapterItemPdu.type = pdu.RCPDU_REG_REGISTER_OBJ; | ||
| 264 | + | ||
| 265 | + let registerObjPdu = new pdu['RCRegistryRegisterObjPdu']; | ||
| 266 | + registerObjPdu.type = type; | ||
| 267 | + registerObjPdu.objId = id; | ||
| 268 | + registerObjPdu.name = name; | ||
| 269 | + registerObjPdu.tag = tag; | ||
| 270 | + if (owner) { | ||
| 271 | + registerObjPdu.owner = owner; | ||
| 272 | + } | ||
| 273 | + if (user_data.length) { | ||
| 274 | + registerObjPdu.userData = user_data; | ||
| 275 | + } | ||
| 276 | + | ||
| 277 | + adapterItemPdu.itemData = registerObjPdu.toArrayBuffer(); | ||
| 278 | + this._adapter_pdu.item.push(adapterItemPdu); | ||
| 279 | + } | ||
| 280 | + | ||
| 281 | + send(appPdu) { | ||
| 282 | + loger.log('Ape发送数据NORMAL PDU', appPdu); | ||
| 283 | + let normalPdu = pdu.create_normal_pdu( | ||
| 284 | + appPdu.type, | ||
| 285 | + this._confInfo.nodeId, | ||
| 286 | + this._confInfo.confId, | ||
| 287 | + this._session_id, | ||
| 288 | + this._channel_id, | ||
| 289 | + true, | ||
| 290 | + true, | ||
| 291 | + PduConsts.DP_TOP, | ||
| 292 | + this._confInfo.topNodeID, | ||
| 293 | + PduConsts.SEG_ONCE | ||
| 294 | + ); | ||
| 295 | + normalPdu.data = appPdu.toArrayBuffer(); | ||
| 296 | + // Mcu发送 | ||
| 297 | + this.mcu.send(normalPdu); | ||
| 298 | + } | ||
| 299 | + | ||
| 300 | + // 发送当前APE(session uniform包) | ||
| 301 | + sendUniform(appPdu, top) { | ||
| 302 | + loger.log('Ape发送数据UNIFORM PDU', appPdu); | ||
| 303 | + let uniformPdu = pdu.create_uniform_pdu( | ||
| 304 | + appPdu.type, | ||
| 305 | + this._confInfo.nodeId, | ||
| 306 | + this._confInfo.confId, | ||
| 307 | + this._session_id, | ||
| 308 | + top ? ApeConsts.BROADCAST_CHANNEL_ID : this._channel_id, | ||
| 309 | + true, | ||
| 310 | + PduConsts.DP_TOP, | ||
| 311 | + top ? this._confInfo.topNodeID : (appPdu.peer || 0), | ||
| 312 | + PduConsts.SEG_ONCE | ||
| 313 | + ); | ||
| 314 | + uniformPdu.data = appPdu.toArrayBuffer(); | ||
| 315 | + // Mcu发送 | ||
| 316 | + this.mcu.send(uniformPdu); | ||
| 317 | + } | ||
| 318 | +} | ||
| 319 | + |
src/apes/ApeConsts.js
0 → 100644
| 1 | +export default function ApeConsts(id) { | ||
| 2 | + for (var type_const in ApeConsts) { | ||
| 3 | + if (ApeConsts[type_const] === id) { | ||
| 4 | + return type_const; | ||
| 5 | + } | ||
| 6 | + } | ||
| 7 | +} | ||
| 8 | + | ||
| 9 | +ApeConsts.NR_GUEST = 0; | ||
| 10 | +ApeConsts.NR_NORMAL = 1; | ||
| 11 | +ApeConsts.NR_ADMIN = 2; | ||
| 12 | +ApeConsts.NR_MASTER = 4; | ||
| 13 | +ApeConsts.NR_SLAVE = 8; | ||
| 14 | +ApeConsts.NR_ASSISTANT = 16; | ||
| 15 | +ApeConsts.NR_INVISIBLE = 32; | ||
| 16 | + | ||
| 17 | +ApeConsts.INVALIDATE_CHANNEL_ID = -1; | ||
| 18 | +ApeConsts.INVALIDATE_NODE_ID = -1; | ||
| 19 | + | ||
| 20 | +// doc update status | ||
| 21 | +ApeConsts.DOCUMENT_LOAD = 0; | ||
| 22 | +ApeConsts.DOCUMENT_DEL = 1; | ||
| 23 | + | ||
| 24 | +// RCChannelGrabStatus | ||
| 25 | +ApeConsts.CGS_RELEASED = 0; | ||
| 26 | +ApeConsts.CGS_PENDING = 1; | ||
| 27 | +ApeConsts.CGS_OPENNED = 2; | ||
| 28 | +ApeConsts.CGS_GRABBING = 3; | ||
| 29 | + | ||
| 30 | +// defs for common session id | ||
| 31 | +ApeConsts.CONFERENCE_SESSION_ID = 11; | ||
| 32 | +ApeConsts.CHAT_SESSION_ID = 12; | ||
| 33 | +ApeConsts.GIFT_SESSION_ID = 13; | ||
| 34 | +ApeConsts.AUDIO_SESSION_ID = 14; | ||
| 35 | +ApeConsts.VIDEO_SESSION_ID = 15; | ||
| 36 | +ApeConsts.WEBSHARING_SESSION_ID = 16; | ||
| 37 | +ApeConsts.DOCSHARING_SESSION_ID = 17; | ||
| 38 | +ApeConsts.WHITEBOARD_SESSION_ID = 18; | ||
| 39 | +ApeConsts.MEDIA_SESSION_ID = 19; | ||
| 40 | +ApeConsts.SCREENSHARING_SESSION_ID = 20; | ||
| 41 | +ApeConsts.POLL_SESSION_ID = 21; | ||
| 42 | + | ||
| 43 | +// defs for common channel id | ||
| 44 | +ApeConsts.BROADCAST_CHANNEL_ID = 0; | ||
| 45 | +ApeConsts.CONFERENCE_CHANNEL_ID = ApeConsts.CONFERENCE_SESSION_ID; | ||
| 46 | +ApeConsts.CHAT_CHANNEL_ID = ApeConsts.CHAT_SESSION_ID; | ||
| 47 | +ApeConsts.GIFT_CHANNEL_ID = ApeConsts.GIFT_SESSION_ID; | ||
| 48 | +ApeConsts.WEBSHARING_CHANNEL_ID = ApeConsts.WEBSHARING_SESSION_ID; | ||
| 49 | +ApeConsts.DOCSHARING_CHANNEL_ID = ApeConsts.DOCSHARING_SESSION_ID; | ||
| 50 | +ApeConsts.WHITEBOARD_CHANNEL_ID = ApeConsts.WHITEBOARD_SESSION_ID; | ||
| 51 | +ApeConsts.MEDIA_CHANNEL_ID = ApeConsts.MEDIA_SESSION_ID; | ||
| 52 | +ApeConsts.SCREENSHARING_CHANNEL_ID = ApeConsts.SCREENSHARING_SESSION_ID; | ||
| 53 | + | ||
| 54 | +// defs for common session name | ||
| 55 | +ApeConsts.CONFERENCE_SESSION_NAME = "conference app"; | ||
| 56 | +ApeConsts.CHAT_SESSION_NAME = "chat app"; | ||
| 57 | +ApeConsts.GIFT_SESSION_NAME = "gift app"; | ||
| 58 | +ApeConsts.AUDIO_SESSION_NAME = "audio app"; | ||
| 59 | +ApeConsts.VIDEO_SESSION_NAME = "video app"; | ||
| 60 | +ApeConsts.WEBSHARING_SESSION_NAME = "web sharing app"; | ||
| 61 | +ApeConsts.DOCSHARING_SESSION_NAME = "doc sharing app"; | ||
| 62 | +ApeConsts.WHITEBOARD_SESSION_NAME = "whiteboard app"; | ||
| 63 | +ApeConsts.MEDIA_SESSION_NAME = "media sharing app"; | ||
| 64 | +ApeConsts.SCREENSHARING_SESSION_NAME = "screen sharing app"; | ||
| 65 | + | ||
| 66 | +// def for common session tag | ||
| 67 | +ApeConsts.CONFERENCE_SESSION_TAG = "con-tag"; | ||
| 68 | +ApeConsts.CHAT_SESSION_TAG = "cha-tag"; | ||
| 69 | +ApeConsts.GIFT_SESSION_TAG = "gif-tag"; | ||
| 70 | +ApeConsts.AUDIO_SESSION_TAG = "aud-tag"; | ||
| 71 | +ApeConsts.VIDEO_SESSION_TAG = "vid-tag"; | ||
| 72 | +ApeConsts.WEBSHARING_SESSION_TAG = "web-tag"; | ||
| 73 | +ApeConsts.DOCSHARING_SESSION_TAG = "doc-tag"; | ||
| 74 | +ApeConsts.WHITEBOARD_SESSION_TAG = "wbd-tag"; | ||
| 75 | +ApeConsts.MEDIA_SESSION_TAG = "med-tag"; | ||
| 76 | +ApeConsts.SCREENSHARING_SESSION_TAG = "scr-tag"; | ||
| 77 | + | ||
| 78 | +ApeConsts.CONFERENCE_OBJ_ROSTER_ID = ((ApeConsts.CONFERENCE_SESSION_ID << 16) + 1); | ||
| 79 | +ApeConsts.CONFERENCE_OBJ_ROSTER_NAME = "node list"; | ||
| 80 | +ApeConsts.CONFERENCE_OBJ_ROSTER_TAG = "node list tag"; | ||
| 81 | + | ||
| 82 | +ApeConsts.CONFERENCE_OBJ_QUEUE_ID = ((ApeConsts.CONFERENCE_SESSION_ID << 16) + 2); | ||
| 83 | +ApeConsts.CONFERENCE_OBJ_QUEUE_NAME = "mic list"; | ||
| 84 | +ApeConsts.CONFERENCE_OBJ_QUEUE_TAG = "mic list tag"; | ||
| 85 | + | ||
| 86 | +// conference tab pages | ||
| 87 | +ApeConsts.CONFERENCE_OBJ_TABLE_ID = ((ApeConsts.CONFERENCE_SESSION_ID << 16) + 3); | ||
| 88 | +ApeConsts.CONFERENCE_OBJ_TABLE_NAME = "tabbar list"; | ||
| 89 | +ApeConsts.CONFERENCE_OBJ_TABLE_TAG = "tabbar list tag"; | ||
| 90 | + | ||
| 91 | +// owned id list is unique in conference | ||
| 92 | +ApeConsts.CONFERENCE_OBJ_COUNTER_ID = ((ApeConsts.CONFERENCE_SESSION_ID << 16) + 4); | ||
| 93 | +ApeConsts.CONFERENCE_OBJ_COUNTER_NAME = "id list"; | ||
| 94 | +ApeConsts.CONFERENCE_OBJ_COUNTER_TAG = "id list tag"; | ||
| 95 | + | ||
| 96 | +// web sharing objects | ||
| 97 | +ApeConsts.WEBSHARING_OBJ_TABLE_ID = ((ApeConsts.WEBSHARING_SESSION_ID << 16) + 1); | ||
| 98 | +ApeConsts.WEBSHARING_OBJ_TABLE_NAME = "web list"; | ||
| 99 | +ApeConsts.WEBSHARING_OBJ_TABLE_TAG = "web list tag"; | ||
| 100 | + | ||
| 101 | +// doc sharing objects | ||
| 102 | +ApeConsts.DOCSHARING_OBJ_TABLE_ID = ((ApeConsts.DOCSHARING_SESSION_ID << 16) + 1); | ||
| 103 | +ApeConsts.DOCSHARING_OBJ_TABLE_NAME = "doc list"; | ||
| 104 | +ApeConsts.DOCSHARING_OBJ_TABLE_TAG = "doc list tag"; | ||
| 105 | + | ||
| 106 | +// doc sharing objects h5 | ||
| 107 | +ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5 = ((ApeConsts.DOCSHARING_SESSION_ID << 16) + 2); | ||
| 108 | +ApeConsts.DOCSHARING_OBJ_TABLE_NAME_H5 = "doc list h5"; | ||
| 109 | +ApeConsts.DOCSHARING_OBJ_TABLE_TAG_H5 = "doc list tag h5"; | ||
| 110 | + | ||
| 111 | +// whiteboard objects | ||
| 112 | +ApeConsts.WHITEBOARD_OBJ_TABLE_ID = ((ApeConsts.WHITEBOARD_SESSION_ID << 16) + 1); | ||
| 113 | +ApeConsts.WHITEBOARD_OBJ_TABLE_NAME = "wbd list"; | ||
| 114 | +ApeConsts.WHITEBOARD_OBJ_TABLE_TAG = "wbd list tag"; | ||
| 115 | + | ||
| 116 | +// media sharing objects | ||
| 117 | +ApeConsts.MEDIA_OBJ_TABLE_ID = ((ApeConsts.MEDIA_SESSION_ID << 16) + 1); | ||
| 118 | +ApeConsts.MEDIA_OBJ_TABLE_NAME = "med list"; | ||
| 119 | +ApeConsts.MEDIA_OBJ_TABLE_TAG = "med list tag"; | ||
| 120 | + | ||
| 121 | +// chat sharing objects | ||
| 122 | +ApeConsts.CHAT_OBJ_TABLE_ID = ((ApeConsts.CHAT_SESSION_ID << 16) + 1); | ||
| 123 | +ApeConsts.CHAT_OBJ_TABLE_NAME = "chat list"; | ||
| 124 | +ApeConsts.CHAT_OBJ_TABLE_TAG = "chat list tag"; | ||
| 125 | + | ||
| 126 | +ApeConsts.AUDIO_OBJ_TABLE_ID = ((ApeConsts.AUDIO_SESSION_ID << 16) + 1); | ||
| 127 | +ApeConsts.AUDIO_OBJ_TABLE_NAME = "audio channel list"; | ||
| 128 | +ApeConsts.AUDIO_OBJ_TABLE_TAG = "audio channel list tag"; | ||
| 129 | + | ||
| 130 | +ApeConsts.VIDEO_OBJ_TABLE_ID = ((ApeConsts.VIDEO_SESSION_ID << 16) + 1); | ||
| 131 | +ApeConsts.VIDEO_OBJ_TABLE_NAME = "video channel list"; | ||
| 132 | +ApeConsts.VIDEO_OBJ_TABLE_TAG = "video channel list tag"; | ||
| 133 | + | ||
| 134 | +// screen sharing objects | ||
| 135 | +ApeConsts.SCREENSHARING_OBJ_TABLE_ID = ((ApeConsts.SCREENSHARING_SESSION_ID << 16) + 1); | ||
| 136 | +ApeConsts.SCREEN_OBJ_TABLE_NAME = "scr list"; | ||
| 137 | +ApeConsts.SCREEN_OBJ_TABLE_TAG = "scr list tag"; | ||
| 138 | + | ||
| 139 | +// poll sharing objects | ||
| 140 | +ApeConsts.POLL_OBJ_TABLE_ID = ((ApeConsts.POLL_SESSION_ID << 16) + 1); | ||
| 141 | +ApeConsts.VOTE_OBJ_TABLE_ID = ((ApeConsts.POLL_SESSION_ID << 16) + 2); | ||
| 142 | +ApeConsts.RECORD_OBJ_TABLE_ID = ((ApeConsts.POLL_SESSION_ID << 16) + 3); | ||
| 143 | +ApeConsts.SHAMLIVE_OBJ_TABLE_ID = ((ApeConsts.POLL_SESSION_ID << 16) + 4); | ||
| 144 | + | ||
| 145 | +ApeConsts.POLL_OBJ_TABLE_NAME = "poll list"; | ||
| 146 | +ApeConsts.POLL_OBJ_TABLE_TAG = "poll list tag"; | ||
| 147 | + | ||
| 148 | +// registry operation const | ||
| 149 | +ApeConsts.REG_TABLE_INSERT_TAIL = 0xFFFFFF; | ||
| 150 | +ApeConsts.REG_TABLE_DELETE_ALL = 0xFFFFFF; | ||
| 151 | + | ||
| 152 | +ApeConsts.CJS_RELEASED = 0; | ||
| 153 | +ApeConsts.CJS_JOINNING = 1; | ||
| 154 | +ApeConsts.CJS_JOINNED = 2; | ||
| 155 | + | ||
| 156 | +// 白板动作 | ||
| 157 | +ApeConsts.WBA_CLOSE = 1; | ||
| 158 | +ApeConsts.WBA_CHANGE = 2; | ||
| 159 | +ApeConsts.WBA_OPEN = 3; | ||
| 160 | +ApeConsts.WBA_DOC_ANNOTATION = 4; | ||
| 161 | +ApeConsts.WBA_LASER_PEN = 5; | ||
| 162 | + |
src/apes/ChatApe.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-14 15:55:42 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2016-09-06 16:28:14 | ||
| 12 | +// Description: LiveClass-ChatApe | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | + | ||
| 16 | +import Ape from './Ape'; | ||
| 17 | +import ApeConsts from './ApeConsts'; | ||
| 18 | +import pdu from 'pdu'; | ||
| 19 | +import Loger from 'Loger'; | ||
| 20 | +import MessageTypes from 'MessageTypes'; | ||
| 21 | + | ||
| 22 | +let loger = Loger.getLoger('ChatApe'); | ||
| 23 | + | ||
| 24 | +class ChatApe extends Ape { | ||
| 25 | + constructor() { | ||
| 26 | + super( | ||
| 27 | + ApeConsts.CHAT_SESSION_ID, | ||
| 28 | + ApeConsts.CHAT_SESSION_NAME, | ||
| 29 | + ApeConsts.CHAT_SESSION_TAG | ||
| 30 | + ); | ||
| 31 | + | ||
| 32 | + //Ape Models | ||
| 33 | + this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | ||
| 34 | + this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CHAT_OBJ_TABLE_ID, | ||
| 35 | + ApeConsts.CHAT_OBJ_TABLE_NAME, ApeConsts.CHAT_OBJ_TABLE_TAG, 0, new ArrayBuffer); | ||
| 36 | + | ||
| 37 | + // ape listeners | ||
| 38 | + this.on(pdu.RCPDU_CHAT_SEND_DATA_REQUEST, this.chatMsgIncomingHandler.bind(this)); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + chatMsgIncomingHandler(pdu) { | ||
| 42 | + | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + sendChatMsg(to, message) { | ||
| 46 | + loger.log('发送聊天消息.', to, message); | ||
| 47 | + let chatSendPdu = new pdu['RCChatSendDataRequestPdu']; | ||
| 48 | + chatSendPdu.type = pdu.RCPDU_CHAT_SEND_DATA_REQUEST; | ||
| 49 | + chatSendPdu.initiator = this._confInfo.nodeId; | ||
| 50 | + chatSendPdu.peer = to; | ||
| 51 | + chatSendPdu.isPublic = true; | ||
| 52 | + chatSendPdu.userData = this._rCArrayBufferUtil.strToUint8Array("h5" + message); | ||
| 53 | + chatSendPdu.fromName = this._rCArrayBufferUtil.strToUint8Array("h5" + this._confInfo.userName); | ||
| 54 | + chatSendPdu.fromRole = this._confInfo.classRole; | ||
| 55 | + if (!(chatSendPdu.isPublic || 0 === chatSendPdu.peer)) { | ||
| 56 | + this.send(chatSendPdu); | ||
| 57 | + } else { | ||
| 58 | + this.sendUniform(chatSendPdu); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + chatMsgIncomingHandler(chatBuffer) { | ||
| 63 | + var chatReceivePdu = pdu['RCChatSendDataRequestPdu'].decode(chatBuffer); | ||
| 64 | + | ||
| 65 | + var chatMsg = {}; | ||
| 66 | + chatMsg.fromNodeID = chatReceivePdu.initiator; | ||
| 67 | + chatMsg.toNodeID = chatReceivePdu.peer; | ||
| 68 | + chatMsg.message = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.userData, 2); | ||
| 69 | + chatMsg.fromName = this._rCArrayBufferUtil.uint8ArrayToStr(chatReceivePdu.fromName, 2); | ||
| 70 | + chatMsg.fromRole = chatReceivePdu.fromRole; | ||
| 71 | + | ||
| 72 | + loger.log('接受聊天消息.', chatMsg); | ||
| 73 | + | ||
| 74 | + this.emit(MessageTypes.CHAT_RECEIVE, chatMsg); | ||
| 75 | + } | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +export default ChatApe; | ||
| 79 | + |
src/apes/ConferApe.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-22 09:57:12 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2016-09-07 16:16:35 | ||
| 12 | +// Description: LiveClass-ConferApe | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | + | ||
| 16 | +import Ape from './Ape'; | ||
| 17 | +import ApeConsts from './ApeConsts'; | ||
| 18 | +import MessageTypes from 'MessageTypes'; | ||
| 19 | +import pdu from 'pdu'; | ||
| 20 | +import { Zlib } from 'zlibjs/bin/zlib.min'; | ||
| 21 | +import UTF8 from 'utf-8'; | ||
| 22 | +import Loger from 'Loger'; | ||
| 23 | +let loger = Loger.getLoger('ConferApe'); | ||
| 24 | + | ||
| 25 | +class ConferApe extends Ape { | ||
| 26 | + constructor() { | ||
| 27 | + super( | ||
| 28 | + ApeConsts.CONFERENCE_SESSION_ID, | ||
| 29 | + ApeConsts.CONFERENCE_SESSION_NAME, | ||
| 30 | + ApeConsts.CONFERENCE_SESSION_TAG | ||
| 31 | + ); | ||
| 32 | + | ||
| 33 | + // Attribures | ||
| 34 | + this.hostNodeId = -1; | ||
| 35 | + this.hostUserId = ''; | ||
| 36 | + this.rosters = {}; | ||
| 37 | + this.activeDocId = ''; | ||
| 38 | + | ||
| 39 | + // Ape Models | ||
| 40 | + this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | ||
| 41 | + this.registerObj(pdu.RCPDU_REG_REGISTER_ROSTER, ApeConsts.CONFERENCE_OBJ_ROSTER_ID, | ||
| 42 | + ApeConsts.CONFERENCE_OBJ_ROSTER_NAME, ApeConsts.CONFERENCE_OBJ_ROSTER_TAG, 0, new ArrayBuffer); | ||
| 43 | + this.registerObj(pdu.RCPDU_REG_REGISTER_QUEUE, ApeConsts.CONFERENCE_OBJ_QUEUE_ID, | ||
| 44 | + ApeConsts.CONFERENCE_OBJ_QUEUE_NAME, ApeConsts.CONFERENCE_OBJ_QUEUE_TAG, 0, new ArrayBuffer); | ||
| 45 | + this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.CONFERENCE_OBJ_TABLE_ID, | ||
| 46 | + ApeConsts.CONFERENCE_OBJ_TABLE_NAME, ApeConsts.CONFERENCE_OBJ_TABLE_TAG, 0, new ArrayBuffer); | ||
| 47 | + this.registerObj(pdu.RCPDU_REG_REGISTER_COUNTER, ApeConsts.CONFERENCE_OBJ_COUNTER_ID, | ||
| 48 | + ApeConsts.CONFERENCE_OBJ_COUNTER_NAME, ApeConsts.CONFERENCE_OBJ_COUNTER_TAG, 0, new ArrayBuffer); | ||
| 49 | + | ||
| 50 | + this.on(pdu.RCPDU_SESSION_JOIN_RESPONSE, this._joinSessionHandler.bind(this)); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + _joinSessionHandler(confInfo) { | ||
| 54 | + let nodeInfoRecordPdu = this.mcu.mcuConfInfo.self; | ||
| 55 | + | ||
| 56 | + let userDataPdu = new pdu['RCNodeInfoUserDataPdu']; | ||
| 57 | + userDataPdu.qq = ''; | ||
| 58 | + userDataPdu.skype = ''; | ||
| 59 | + userDataPdu.mobile = ''; | ||
| 60 | + | ||
| 61 | + nodeInfoRecordPdu.userData = userDataPdu.toArrayBuffer(); | ||
| 62 | + nodeInfoRecordPdu.deviceType = 3; | ||
| 63 | + | ||
| 64 | + let item = new pdu['RCRegistryRosterItemPdu']; | ||
| 65 | + item.nodeId = nodeInfoRecordPdu.nodeId; | ||
| 66 | + item.nodeData = nodeInfoRecordPdu.toArrayBuffer(); | ||
| 67 | + | ||
| 68 | + let rosterUpdateItem = new pdu['RCRegistryRosterUpdateItemPdu']; | ||
| 69 | + rosterUpdateItem.type = pdu.RCPDU_REG_ROSTER_UPDATE_PDU; | ||
| 70 | + rosterUpdateItem.items.push(item); | ||
| 71 | + | ||
| 72 | + let updateObjPdu = new pdu['RCRegistryUpdateObjPdu']; | ||
| 73 | + updateObjPdu.objId = ApeConsts.CONFERENCE_OBJ_ROSTER_ID; | ||
| 74 | + updateObjPdu.subType = rosterUpdateItem.type; | ||
| 75 | + updateObjPdu.userData = rosterUpdateItem.toArrayBuffer(); | ||
| 76 | + | ||
| 77 | + let adapterItemPdu = new pdu['RCAdapterItemPdu']; | ||
| 78 | + adapterItemPdu.type = pdu.RCPDU_REG_UPDATE_OBJ; | ||
| 79 | + adapterItemPdu.itemData = updateObjPdu.toArrayBuffer(); | ||
| 80 | + | ||
| 81 | + let adapterPdu = new pdu['RCAdapterPdu']; | ||
| 82 | + adapterPdu.type = pdu.RCPDU_REG_ADAPTER; | ||
| 83 | + adapterPdu.item.push(adapterItemPdu); | ||
| 84 | + | ||
| 85 | + this.sendUniform(adapterPdu, true); | ||
| 86 | + | ||
| 87 | + | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + | ||
| 91 | + tableUpdateHandler(owner, recordId, recordData) { | ||
| 92 | + try { | ||
| 93 | + let tabUpdatePdu = pdu.RCTabUpdateDataRequestPdu.decode(recordData); | ||
| 94 | + const uncompressedBytes = new Zlib.Inflate(tabUpdatePdu.action.compact().view).decompress(); | ||
| 95 | + let tabInfo = UTF8.getStringFromBytes(uncompressedBytes); | ||
| 96 | + let tabTypeMatches = tabInfo.match(/<TabType>(.+)<\/TabType>/); | ||
| 97 | + if (tabTypeMatches.length > 1 && tabTypeMatches[1] == 'show.docsharing') { | ||
| 98 | + if (tabInfo.match(/<visible>(.+)<\/visible>/)[1] == 'true') { | ||
| 99 | + this.activeDocId = tabInfo.match(/<TabID>(.+)<\/TabID>/)[1]; | ||
| 100 | + this.emit(MessageTypes.DOC_SWITCH, this.activeDocId); | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + } catch (e) { | ||
| 104 | + loger.warn('ConferApe table update got exception.'); | ||
| 105 | + } | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + | ||
| 109 | + rosterInsertHandler(nodeId, nodeData) { | ||
| 110 | + this.rosterUpdateHandler(nodeId, nodeData); | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + rosterUpdateHandler(nodeId, nodeData) { | ||
| 114 | + if (nodeData.role === ApeConsts.NR_MASTER || | ||
| 115 | + nodeData.role === ApeConsts.NR_SLAVE) { | ||
| 116 | + this.hostNodeId = nodeData.nodeId; | ||
| 117 | + this.hostUserId = nodeData.userId; | ||
| 118 | + } | ||
| 119 | + if (nodeData.role === ApeConsts.NR_NORMAL && | ||
| 120 | + this.hostNodeId === nodeData.nodeId) { | ||
| 121 | + this.hostNodeId = -1; | ||
| 122 | + this.hostUserId = ''; | ||
| 123 | + } | ||
| 124 | + let rosterExists = this.rosters[nodeId]; | ||
| 125 | + this.rosters[nodeId] = nodeData; | ||
| 126 | + if (!rosterExists) { | ||
| 127 | + this.emitRosterChange(); | ||
| 128 | + } | ||
| 129 | + | ||
| 130 | + | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + rosterDelHandler(nodeId) { | ||
| 134 | + delete this.rosters[nodeId]; | ||
| 135 | + this.emitRosterChange(); | ||
| 136 | + // 自己退出 | ||
| 137 | + if (nodeId == this._confInfo.nodeId) { | ||
| 138 | + this.emit(MessageTypes.CONFERENCE_EXIT); | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + emitRosterChange() { | ||
| 143 | + this.emit(MessageTypes.CONFERENCE_SHOW_ROSTER_NUM, Object.keys(this.rosters).length); | ||
| 144 | + } | ||
| 145 | +} | ||
| 146 | + | ||
| 147 | +export default ConferApe; | ||
| 148 | + |
src/apes/DocApe.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-26 17:30:43 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2016-09-21 14:12:25 | ||
| 12 | +// Description: LiveClass-DocApe | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | + | ||
| 16 | +import Ape from './Ape'; | ||
| 17 | +import ApeConsts from './ApeConsts'; | ||
| 18 | +import pdu from 'pdu'; | ||
| 19 | +import Loger from 'Loger'; | ||
| 20 | +import MessageTypes from 'MessageTypes'; | ||
| 21 | + | ||
| 22 | +let loger = Loger.getLoger('DocApe'); | ||
| 23 | + | ||
| 24 | +class DocApe extends Ape { | ||
| 25 | + constructor() { | ||
| 26 | + super( | ||
| 27 | + ApeConsts.DOCSHARING_SESSION_ID, | ||
| 28 | + ApeConsts.DOCSHARING_SESSION_NAME, | ||
| 29 | + ApeConsts.DOCSHARING_SESSION_TAG | ||
| 30 | + ); | ||
| 31 | + this.docList = {}; | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + // Ape Models | ||
| 35 | + this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | ||
| 36 | + this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.DOCSHARING_OBJ_TABLE_ID_H5, ApeConsts.DOCSHARING_OBJ_TABLE_NAME_H5, ApeConsts.DOCSHARING_OBJ_TABLE_TAG_H5, 0, new ArrayBuffer); | ||
| 37 | + | ||
| 38 | + // 延迟 | ||
| 39 | + this._apeDelayed = true; | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + tableInsertHandler(owner, tableId, recordData) { | ||
| 43 | + this.tableUpdateHandler(owner, tableId, recordData); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + tableDeleteHandler(tableId, record){ | ||
| 47 | + const re={}; | ||
| 48 | + re.type=ApeConsts.DOCUMENT_DEL; | ||
| 49 | + this.emit(MessageTypes.DOC_DEL, re); | ||
| 50 | + } | ||
| 51 | + tableUpdateHandler(owner, recordId, recordData) { | ||
| 52 | + try { | ||
| 53 | + const recordInfo = pdu['RCDocSendDataRequestPdu'].decode(recordData); | ||
| 54 | + recordInfo.type = ApeConsts.DOCUMENT_LOAD; | ||
| 55 | + | ||
| 56 | + recordInfo.ext = recordInfo.name.substr(recordInfo.name.indexOf('.') + 1); | ||
| 57 | + recordInfo.wbid = (recordInfo.id << 10) + recordInfo.curPageNo; | ||
| 58 | + recordInfo.isPicture = ~['bmp', 'png', 'gif', 'jpg', 'jpeg'].indexOf(recordInfo.ext); | ||
| 59 | + | ||
| 60 | + if (recordInfo.isPicture) { | ||
| 61 | + recordInfo.namePath = recordInfo.uri.substring(0, recordInfo.uri.lastIndexOf('.')); | ||
| 62 | + recordInfo.loadURL = recordInfo.namePath + '.' + recordInfo.ext; | ||
| 63 | + } else { | ||
| 64 | + recordInfo.namePath = recordInfo.uri.substring(0, recordInfo.uri.lastIndexOf('/')); | ||
| 65 | + recordInfo.loadURL = `${recordInfo.namePath}/${recordInfo.curPageNo}.jpg`; | ||
| 66 | + } | ||
| 67 | + this.docList[recordId] = recordInfo; | ||
| 68 | + this.emit(MessageTypes.DOC_UPDATE, recordInfo); | ||
| 69 | + loger.log('Doc update ->' + recordId); | ||
| 70 | + } catch (e) { | ||
| 71 | + loger.warn('Doc Table Update Decode包异常'); | ||
| 72 | + } | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + | ||
| 76 | +} | ||
| 77 | + | ||
| 78 | +export default DocApe; | ||
| 79 | + |
src/apes/VideoApe.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-23 18:07:28 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2016-09-06 11:13:59 | ||
| 12 | +// Description: LiveClass-VideoApe | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | + | ||
| 16 | +import Ape from './Ape'; | ||
| 17 | +import ApeConsts from './ApeConsts'; | ||
| 18 | +import pdu from 'pdu'; | ||
| 19 | +import Loger from 'Loger'; | ||
| 20 | +import MessageTypes from 'MessageTypes'; | ||
| 21 | + | ||
| 22 | +let loger = Loger.getLoger('VideoChat'); | ||
| 23 | + | ||
| 24 | +class VideoChat extends Ape { | ||
| 25 | + constructor() { | ||
| 26 | + super( | ||
| 27 | + ApeConsts.VIDEO_SESSION_ID, | ||
| 28 | + ApeConsts.VIDEO_SESSION_NAME, | ||
| 29 | + ApeConsts.VIDEO_SESSION_TAG | ||
| 30 | + | ||
| 31 | + | ||
| 32 | + ); | ||
| 33 | + | ||
| 34 | + //Attributes | ||
| 35 | + this.videoChannels = {}; | ||
| 36 | + this.activeChannelId = 0; | ||
| 37 | + this.activeURL = ''; | ||
| 38 | + | ||
| 39 | + | ||
| 40 | + // Ape Models | ||
| 41 | + this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | ||
| 42 | + this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.VIDEO_OBJ_TABLE_ID, ApeConsts.VIDEO_OBJ_TABLE_NAME, ApeConsts.VIDEO_OBJ_TABLE_TAG, 0, new ArrayBuffer); | ||
| 43 | + | ||
| 44 | + | ||
| 45 | + // ape listeners | ||
| 46 | + this.on(pdu.RCPDU_VIDEO_SEND_DATA_REQUEST, this.videoIncomingHandler.bind(this)); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + // 视频消息处理 | ||
| 50 | + videoIncomingHandler(videoBuffer) { | ||
| 51 | + let videoReceivePdu = pdu['VideoSendDataRequestPdu'].decode(videoBuffer); | ||
| 52 | + | ||
| 53 | + let video_data = { }; | ||
| 54 | + video_data._initiator = videoReceivePdu.initiator; | ||
| 55 | + video_data._is_key_frame = videoReceivePdu.keyFrame; | ||
| 56 | + video_data._sequence_id = videoReceivePdu.sequenceId; | ||
| 57 | + video_data._slice_id = videoReceivePdu.sliceId; | ||
| 58 | + video_data._data = videoReceivePdu.userData; | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + // this._notify(RCApeEvent.E_VIDEO_DATA, videoReceivePdu.sessionId, videoReceivePdu.channelId, video_data); | ||
| 62 | + loger.log('接受视频消息.', video_data); | ||
| 63 | + this.emit(MessageTypes.VIDEO_SHOW, video_data); | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + tableUpdateHandler(ownerId, channelId, channelInfo) { | ||
| 68 | + // debugger; | ||
| 69 | + let videoChannelInfo = pdu['RCVideoChannelInfoRecordPdu'].decode(channelInfo); | ||
| 70 | + videoChannelInfo.owner = ownerId; | ||
| 71 | + videoChannelInfo.channelId = channelId; | ||
| 72 | + videoChannelInfo.status = ownerId === 0 ? ApeConsts.CGS_RELEASED : videoChannelInfo.status; | ||
| 73 | + | ||
| 74 | + this.videoChannels[channelId] = videoChannelInfo; | ||
| 75 | + switch (videoChannelInfo.status) { | ||
| 76 | + case ApeConsts.CGS_RELEASED: | ||
| 77 | + case ApeConsts.CGS_PENDING: | ||
| 78 | + case ApeConsts.CGS_GRABBING: | ||
| 79 | + // 只能关闭自己的流 | ||
| 80 | + if (this.activeChannelId === videoChannelInfo.channelId) { | ||
| 81 | + this.activeChannelId = 0; | ||
| 82 | + this.activeURL = ''; | ||
| 83 | + this.emitVideoChange(); | ||
| 84 | + } | ||
| 85 | + break; | ||
| 86 | + case ApeConsts.CGS_OPENNED: | ||
| 87 | + this.activeChannelId = videoChannelInfo.channelId; | ||
| 88 | + // AMS | ||
| 89 | + if (this._confInfo.msType === '1') { | ||
| 90 | + | ||
| 91 | + this.activeURL = `http://dazhi.3mang.com/live/${this._confInfo.confId}/${this._confInfo.confId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`; | ||
| 92 | + | ||
| 93 | + | ||
| 94 | + }else { | ||
| 95 | + this.activeURL = `http://hls.3mang.com/live/${this._confInfo.confId}_${videoChannelInfo.channelId}_flash_cam_mic_aac/playlist.m3u8`; | ||
| 96 | + } | ||
| 97 | + // 任何人都可以打开流 | ||
| 98 | + this.emitVideoChange(); | ||
| 99 | + break; | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + emitVideoChange() { | ||
| 104 | + this.emit(MessageTypes.VIDEO_SHOW, { | ||
| 105 | + activeChannelId: this.activeChannelId, | ||
| 106 | + HLSURL: this.activeURL, | ||
| 107 | + }); | ||
| 108 | + }; | ||
| 109 | + | ||
| 110 | +} | ||
| 111 | + | ||
| 112 | +export default VideoChat; | ||
| 113 | + |
src/apes/WhiteBoardApe.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-26 17:36:20 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2016-09-21 14:06:12 | ||
| 12 | +// Description: LiveClass-WhiteBoardApe | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | + | ||
| 16 | +import Ape from './Ape'; | ||
| 17 | +import ApeConsts from './ApeConsts'; | ||
| 18 | +import pdu from 'pdu'; | ||
| 19 | +import Loger from 'Loger'; | ||
| 20 | +import MessageTypes from 'MessageTypes'; | ||
| 21 | +import { Zlib } from 'zlibjs/bin/zlib.min'; | ||
| 22 | +import UTF8 from 'utf-8'; | ||
| 23 | + | ||
| 24 | +let loger = Loger.getLoger('WhiteBoardApe'); | ||
| 25 | + | ||
| 26 | +class WhiteBoardApe extends Ape { | ||
| 27 | + constructor() { | ||
| 28 | + super( | ||
| 29 | + ApeConsts.WHITEBOARD_SESSION_ID, | ||
| 30 | + ApeConsts.WHITEBOARD_SESSION_NAME, | ||
| 31 | + ApeConsts.WHITEBOARD_SESSION_TAG | ||
| 32 | + ); | ||
| 33 | + // properties | ||
| 34 | + this.annoInfos = {}; | ||
| 35 | + | ||
| 36 | + //Ape Models | ||
| 37 | + this.registerKey(this._session_id, this._session_name, this._session_tag, new ArrayBuffer); | ||
| 38 | + this.registerObj(pdu.RCPDU_REG_REGISTER_TABLE, ApeConsts.WHITEBOARD_OBJ_TABLE_ID, | ||
| 39 | + ApeConsts.WHITEBOARD_OBJ_TABLE_NAME, ApeConsts.WHITEBOARD_OBJ_TABLE_TAG, 0, new ArrayBuffer); | ||
| 40 | + | ||
| 41 | + // ape listeners | ||
| 42 | + this.on(pdu.RCPDU_CONFERENCE_SEND_DATA_REQUEST, this.whiteboardMsgComingHandler.bind(this)); | ||
| 43 | + | ||
| 44 | + // 白板延迟 | ||
| 45 | + this._apeDelayed = true; | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + whiteboardMsgComingHandler(pdu) { | ||
| 49 | + loger.warn('whiteboardMsgComingHandler needs to be handled.'); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + tableInsertHandler(tableId, record) { | ||
| 53 | + this.emitDocChange(ApeConsts.DOCUMENT_DEL); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + tableUpdateHandler(owner, recordId, recordData) { | ||
| 57 | + const recordInfo = pdu['RCWhiteboardDataRequestPdu'].decode(recordData); | ||
| 58 | + // 目前只处理 文档标注 | ||
| 59 | + if (recordInfo.type == ApeConsts.WBA_DOC_ANNOTATION) { | ||
| 60 | + const uncompressedBytes = new Zlib.Inflate(recordInfo.action.compact().view).decompress(); | ||
| 61 | + const annoInfo = { | ||
| 62 | + id: recordId, | ||
| 63 | + svg: UTF8.getStringFromBytes(uncompressedBytes) | ||
| 64 | + }; | ||
| 65 | + this.annoInfos[recordId] = annoInfo; | ||
| 66 | + this.emit(MessageTypes.ANNO_UPDATE, annoInfo); | ||
| 67 | + } else { | ||
| 68 | + loger.log('白板动作忽略,类型:', ApeConsts(recordInfo.type)); | ||
| 69 | + } | ||
| 70 | + } | ||
| 71 | +} | ||
| 72 | + | ||
| 73 | +export default WhiteBoardApe; | ||
| 74 | + |
src/assets/css/README.md
0 → 100644
| 1 | +# CSS FILE FOLDER |
src/assets/font/README.md
0 → 100644
| 1 | +# FONT FILE FOLDER |
src/assets/img/README.md
0 → 100644
| 1 | +# IMAGE FILE FOLDER |
src/events/RCMessageCallback.js
0 → 100644
| 1 | +export default class RCMessageCallback { | ||
| 2 | + constructor() { | ||
| 3 | + this.type; | ||
| 4 | + this.message; | ||
| 5 | + } | ||
| 6 | + | ||
| 7 | + create_notify_message(msgType, msgData) { | ||
| 8 | + this.type = msgType; | ||
| 9 | + this.message = msgData; | ||
| 10 | + } | ||
| 11 | +} | ||
| 12 | + | ||
| 13 | +RCMessageCallback.MESSAGE_VIDEO = "video.message"; | ||
| 14 | +RCMessageCallback.MESSAGE_DOCUMENT = "document.message"; | ||
| 15 | +RCMessageCallback.MESSAGE_CHAT = "chat.message"; | ||
| 16 | +RCMessageCallback.MESSAGE_Notify = "notify.message"; | ||
| 17 | +RCMessageCallback.MESSAGE_ROSTER_NUM = "roster_num.message"; | ||
| 18 | +RCMessageCallback.MESSAGE_CLASS_DETAIL = "class_detail.message"; | ||
| 19 | + |
src/index.js
0 → 100644
| 1 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 2 | +// | ||
| 3 | +// Copyright (C) 2016-present All Rights Reserved. | ||
| 4 | +// Licensed under the Apache License, Version 2.0 (the "License"); | ||
| 5 | +// http://www.apache.org/licenses/LICENSE-2.0 | ||
| 6 | +// | ||
| 7 | +// Github Home: https://github.com/AlexWang1987 | ||
| 8 | +// Author: AlexWang | ||
| 9 | +// Date: 2016-08-27 23:06:26 | ||
| 10 | +// QQ Email: 1669499355@qq.com | ||
| 11 | +// Last Modified time: 2016-09-04 01:02:29 | ||
| 12 | +// Description: LiveClass-undefined | ||
| 13 | +// | ||
| 14 | +// ////////////////////////////////////////////////////////////////////////////// | ||
| 15 | +import util from 'util'; | ||
| 16 | +import Emiter from 'Emiter'; | ||
| 17 | +import MessageTypes from 'MessageTypes'; | ||
| 18 | +import mcu from 'mcu'; | ||
| 19 | +import mcu from 'mcu.js'; | ||
| 20 | +import muc from 'mcu.js'; | ||
| 21 | +import dfjsd from 'Loger'; | ||
| 22 | + | ||
| 23 | +import fdsfds from 'mcu'; | ||
| 24 | + | ||
| 25 | +import alexwang from 'MessageEngine.js'; | ||
| 26 | + |
src/libs/ArrayBufferUtil.js
0 → 100644
| 1 | +export default class ArrayBufferUtil { | ||
| 2 | + static ab2str(buf) { | ||
| 3 | + return String.fromCharCode.apply(null, new Uint16Array(buf)); | ||
| 4 | + } | ||
| 5 | + | ||
| 6 | + static str2ab(str) { | ||
| 7 | + let buf = new ArrayBuffer(str.length * 2); // one char use 2 byte | ||
| 8 | + let bufView = new Uint16Array(buf); | ||
| 9 | + for (let i = 0, strLen = str.length; i < strLen; i++) { | ||
| 10 | + bufView[i] = str.charCodeAt(i); | ||
| 11 | + } | ||
| 12 | + return buf; | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + static strToUint8Array(str) { | ||
| 16 | + let out, i, len, c; | ||
| 17 | + out = ""; | ||
| 18 | + len = str.length; | ||
| 19 | + let uintArray = []; | ||
| 20 | + for (i = 0; i < len; i++) { | ||
| 21 | + c = str.charCodeAt(i); | ||
| 22 | + if ((c >= 0x0001) && (c <= 0x007F)) { | ||
| 23 | + uintArray.push(c); | ||
| 24 | + } else if (c > 0x07FF) { | ||
| 25 | + uintArray.push(0xE0 | ((c >> 12) & 0x0F)); | ||
| 26 | + uintArray.push(0x80 | ((c >> 6) & 0x3F)); | ||
| 27 | + uintArray.push(0x80 | ((c >> 0) & 0x3F)); | ||
| 28 | + //out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F)); | ||
| 29 | + //out += String.fromCharCode(0x80 | ((c >> 6) & 0x3F)); | ||
| 30 | + //out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); | ||
| 31 | + } else { | ||
| 32 | + uintArray.push(0xC0 | ((c >> 6) & 0x1F)); | ||
| 33 | + uintArray.push(0x80 | ((c >> 0) & 0x3F)); | ||
| 34 | + //out += String.fromCharCode(0xC0 | ((c >> 6) & 0x1F)); | ||
| 35 | + //out += String.fromCharCode(0x80 | ((c >> 0) & 0x3F)); | ||
| 36 | + } | ||
| 37 | + } | ||
| 38 | + return new Uint8Array(uintArray); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + static uint8ArrayToStr(uint8, index) { | ||
| 42 | + let out, i, len, c; | ||
| 43 | + let char2, char3; | ||
| 44 | + out = ""; | ||
| 45 | + len = uint8.buffer.byteLength; | ||
| 46 | + i = uint8.offset + index; //pzm update 前两个字符乱码 | ||
| 47 | + while (i < uint8.limit) { | ||
| 48 | + c = uint8.view[i++]; | ||
| 49 | + switch (c >> 4) { | ||
| 50 | + case 0: | ||
| 51 | + case 1: | ||
| 52 | + case 2: | ||
| 53 | + case 3: | ||
| 54 | + case 4: | ||
| 55 | + case 5: | ||
| 56 | + case 6: | ||
| 57 | + case 7: | ||
| 58 | + // 0xxxxxxx | ||
| 59 | + out += String.fromCharCode(uint8.view[i - 1]); | ||
| 60 | + break; | ||
| 61 | + case 12: | ||
| 62 | + case 13: | ||
| 63 | + // 110x xxxx 10xx xxxx | ||
| 64 | + char2 = uint8.view[i++]; | ||
| 65 | + out += String.fromCharCode(((c & 0x1F) << 6) | (char2 & 0x3F)); | ||
| 66 | + break; | ||
| 67 | + case 14: | ||
| 68 | + // 1110 xxxx 10xx xxxx 10xx xxxx | ||
| 69 | + char2 = uint8.view[i++]; | ||
| 70 | + char3 = uint8.view[i++]; | ||
| 71 | + out += String.fromCharCode(((c & 0x0F) << 12) | | ||
| 72 | + ((char2 & 0x3F) << 6) | | ||
| 73 | + ((char3 & 0x3F) << 0)); | ||
| 74 | + break; | ||
| 75 | + } | ||
| 76 | + } | ||
| 77 | + return out; | ||
| 78 | + } | ||
| 79 | +} | ||
| 80 | + |
src/mcu.js
0 → 100644
| 1 | +/*eslint-disable*/ | ||
| 2 | + | ||
| 3 | +import Emiter from 'Emiter'; | ||
| 4 | +import MessageTypes from 'MessageTypes'; | ||
| 5 | +import Loger from 'Loger'; | ||
| 6 | +import everSocket from 'everSocket'; | ||
| 7 | +import pdu from 'pdu/index'; | ||
| 8 | +import PduType from 'pdu/PduType'; | ||
| 9 | +import PduConsts from 'pdu/PduConsts'; | ||
| 10 | +import ApeConsts from 'apes/ApeConsts'; | ||
| 11 | +import ConferApe from 'apes/ConferApe'; | ||
| 12 | +import ArrayBufferUtil from 'libs/ArrayBufferUtil'; | ||
| 13 | +import Base64 from 'base64-js'; | ||
| 14 | + | ||
| 15 | +let loger = Loger.getLoger('MCU'); | ||
| 16 | + | ||
| 17 | +class MCU extends Emiter { | ||
| 18 | + constructor() { | ||
| 19 | + super(); | ||
| 20 | + this._apes = {}; | ||
| 21 | + this._everSocket = everSocket; | ||
| 22 | + this._everSocket.on(everSocket.OPEN, this._everSocketOpenHandler.bind(this)); | ||
| 23 | + this._everSocket.on(everSocket.MESSAGE, this._everSocketMsgReceivedHandler.bind(this)); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + // 注册Ape | ||
| 27 | + registerApe(ape) { | ||
| 28 | + this._apes[ape._session_id] = ape; | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | + // EverSocket建立通道完毕 | ||
| 32 | + _everSocketOpenHandler() { | ||
| 33 | + loger.log('MCU-发送加入会议请求.'); | ||
| 34 | + const confInfo = this.confInfo; | ||
| 35 | + | ||
| 36 | + // 刷新nodeId | ||
| 37 | + confInfo.nodeId = parseInt(Date.now() / 1000); | ||
| 38 | + | ||
| 39 | + var joinRequestPdu = new pdu['RCConferenceJoinRequestPdu']; | ||
| 40 | + joinRequestPdu.type = 2; | ||
| 41 | + joinRequestPdu.initiator = confInfo.nodeId; | ||
| 42 | + joinRequestPdu.nodeType = PduConsts.NT_TERMINAL; //normal | ||
| 43 | + | ||
| 44 | + var descriptorPdu = new pdu['RCConferenceDescriptorPdu']; | ||
| 45 | + descriptorPdu.id = confInfo.confId; | ||
| 46 | + descriptorPdu.name = new ArrayBuffer; | ||
| 47 | + descriptorPdu.mode = 0; | ||
| 48 | + descriptorPdu.capacity = 1; | ||
| 49 | + joinRequestPdu.confDesc = descriptorPdu; | ||
| 50 | + | ||
| 51 | + let pduMsg = pdu.create_connect_provider_request_pdu( | ||
| 52 | + joinRequestPdu.type, | ||
| 53 | + confInfo.nodeId, | ||
| 54 | + confInfo.confId, | ||
| 55 | + 0, | ||
| 56 | + ApeConsts.BROADCAST_CHANNEL_ID, | ||
| 57 | + true, | ||
| 58 | + PduConsts.DP_TOP, | ||
| 59 | + confInfo.topNodeID, | ||
| 60 | + PduConsts.SEG_ONCE | ||
| 61 | + ); | ||
| 62 | + | ||
| 63 | + pduMsg.set("site", confInfo.siteId); | ||
| 64 | + pduMsg.set("userId", confInfo.userId); | ||
| 65 | + pduMsg.set("userName", Base64.fromByteArray(ArrayBufferUtil.strToUint8Array(confInfo.userName))); | ||
| 66 | + pduMsg.set("userRole", confInfo.userRole); | ||
| 67 | + pduMsg.set("deviceType", ""); | ||
| 68 | + pduMsg.set("data", joinRequestPdu.toArrayBuffer()); | ||
| 69 | + | ||
| 70 | + this._everSocket.send(pduMsg.toArrayBuffer()); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + // EverSocket底层消息处理 | ||
| 74 | + _everSocketMsgReceivedHandler(data) { | ||
| 75 | + let pduMsg = pdu.decode_pdu(data); | ||
| 76 | + let pduType = pduMsg.get("type"); | ||
| 77 | + let pduData = pduMsg.get("data"); | ||
| 78 | + loger.log('MCU-FirstLayer封装消息', 'type', pdu.id2type(pduMsg.type), pduMsg.type, 'sessionId', ApeConsts(pduMsg.sessionId), pduMsg.sessionId); | ||
| 79 | + switch (pduType) { | ||
| 80 | + case PduType.RCPDU_CONNECT_PROVIDER_RESPONSE: | ||
| 81 | + let joinConfPdu = pdu['RCConferenceJoinResponsePdu'].decode(pduData); | ||
| 82 | + let pduResultCode = joinConfPdu.get("result"); | ||
| 83 | + switch (pduResultCode) { | ||
| 84 | + case PduConsts.RET_SUCCESS: | ||
| 85 | + this._updateMCUConfInfoDesc(joinConfPdu.get("confDesc")); | ||
| 86 | + this.emit(MessageTypes.CONFERENCE_JOIN_SUCCESS, this.confInfo); | ||
| 87 | + break; | ||
| 88 | + case PduConsts.RET_FULL_CAPACITY: | ||
| 89 | + this.emit(MessageTypes.CONFERENCE_JOIN_FULL); | ||
| 90 | + break; | ||
| 91 | + default: | ||
| 92 | + loger.warn('JoinConfPdu-未知类型-等待处理.', pduResultCode); | ||
| 93 | + } | ||
| 94 | + break; | ||
| 95 | + case PduType.RCPDU_SEND_DATA_REQUEST: | ||
| 96 | + let ape = this._apes[pduMsg.sessionId]; | ||
| 97 | + let sessionLabel = ApeConsts(pduMsg.sessionId); | ||
| 98 | + if (ape) { | ||
| 99 | + let subTypeLabel = pdu.id2type(pduMsg.subType); | ||
| 100 | + loger.log('MCU-SecondLayer封装消息', 'sessionId', sessionLabel, pduMsg.sessionId, 'subtype', subTypeLabel, pduMsg.subType); | ||
| 101 | + ape.emit(pduMsg.subType, pduMsg.data); | ||
| 102 | + } else { | ||
| 103 | + loger.warn(sessionLabel + '尚未注册'); | ||
| 104 | + } | ||
| 105 | + break; | ||
| 106 | + default: | ||
| 107 | + loger.warn('PDU-未知类型-等待处理.', pduType); | ||
| 108 | + } | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + _updateMCUConfInfoDesc(mcuConfDesc) { | ||
| 112 | + let info = this.mcuConfInfo.info; | ||
| 113 | + info._conference_name = ArrayBufferUtil.uint8ArrayToStr(mcuConfDesc.name, 0); | ||
| 114 | + info._capacity = mcuConfDesc.capacity; | ||
| 115 | + info._mode = mcuConfDesc.mode; | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + // MU服务是否连接 | ||
| 119 | + get connected() { | ||
| 120 | + if (this._everSocket && this._everSocket.connected) | ||
| 121 | + return true; | ||
| 122 | + return false; | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + // 会议发送消息 -- 消息同意序列号 | ||
| 126 | + send(msg) { | ||
| 127 | + if (this.connected) { | ||
| 128 | + loger.log('MCU-发送会议数据....', msg); | ||
| 129 | + this._everSocket.send(msg.toArrayBuffer()); | ||
| 130 | + } else { | ||
| 131 | + loger.log('MCU-发送会议数据失败,MCU底层通道不可用'); | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + // 主动断开MCU连接 | ||
| 136 | + leaveMCU() { | ||
| 137 | + // for (let ape in this._apes) { | ||
| 138 | + // this._apes[ape].stop(); | ||
| 139 | + // } | ||
| 140 | + this._everSocket.end(); | ||
| 141 | + } | ||
| 142 | + | ||
| 143 | + // 主动建立MCU连接 | ||
| 144 | + joinMCU(_confInfo) { | ||
| 145 | + loger.log('开始建立EverSocket通道.', _confInfo); | ||
| 146 | + _confInfo.confId = parseInt(_confInfo.confId); // confId 必须整形 | ||
| 147 | + this.confInfo = _confInfo; | ||
| 148 | + | ||
| 149 | + let nodeInfoRecordPdu = new pdu['RCNodeInfoRecordPdu']; | ||
| 150 | + nodeInfoRecordPdu.name = this.confInfo.userName; | ||
| 151 | + nodeInfoRecordPdu.nodeId = this.confInfo.nodeId; | ||
| 152 | + nodeInfoRecordPdu.userId = this.confInfo.userId; | ||
| 153 | + nodeInfoRecordPdu.role = 1; //NR_NORMAL | ||
| 154 | + nodeInfoRecordPdu.level = 0; | ||
| 155 | + | ||
| 156 | + let conferenceRecord = {}; //RCConferenceRecord_T | ||
| 157 | + conferenceRecord._conference_id = this.confInfo.confId; | ||
| 158 | + conferenceRecord._top_node_id = this.confInfo.topNodeID; | ||
| 159 | + | ||
| 160 | + this.mcuConfInfo = {}; //RCMeetingInfo_T | ||
| 161 | + this.mcuConfInfo.self = nodeInfoRecordPdu; | ||
| 162 | + this.mcuConfInfo.info = conferenceRecord; | ||
| 163 | + | ||
| 164 | + // 内部mcuConfInfo | ||
| 165 | + this.confInfo.mcuConfInfo = this.mcuConfInfo; | ||
| 166 | + | ||
| 167 | + //开启EverSocket | ||
| 168 | + this._everSocket.begin(this.confInfo.MCUServerIP, this.confInfo.MCUServerPort); | ||
| 169 | + } | ||
| 170 | +} | ||
| 171 | + | ||
| 172 | +export default new MCU; | ||
| 173 | + |
src/pdu/PduConsts.js
0 → 100644
| 1 | +export default function PduConsts() {} | ||
| 2 | + | ||
| 3 | +PduConsts.NT_TERMINAL = 0; | ||
| 4 | +PduConsts.NT_MULTIPORT_TERMINAL = 1; | ||
| 5 | +PduConsts.NT_MCU = 2; | ||
| 6 | + | ||
| 7 | +// PduPriority | ||
| 8 | + | ||
| 9 | +PduConsts.DP_TOP = 0; | ||
| 10 | +PduConsts.DP_HIGH = 1; | ||
| 11 | +PduConsts.DP_MEDIUM = 2; | ||
| 12 | +PduConsts.DP_LOW = 3; | ||
| 13 | + | ||
| 14 | +// PduSegment | ||
| 15 | +PduConsts.SEG_BEGIN = 0; | ||
| 16 | +PduConsts.SEG_END = 1; | ||
| 17 | +PduConsts.SEG_ONCE = 2; | ||
| 18 | + | ||
| 19 | +// PduReturnType | ||
| 20 | +PduConsts.RET_SUCCESS = 0; | ||
| 21 | +PduConsts.RET_USER_REJECTED = 1; | ||
| 22 | +PduConsts.RET_INVALID_CONFERENCE = 2; | ||
| 23 | +PduConsts.RET_INVALID_PASSWORD = 3; | ||
| 24 | +PduConsts.RET_INVALID_CONVENER_PASSWORD = 4; | ||
| 25 | +PduConsts.RET_CHALLENGE_RESPONSE_REQUIRED = 5; | ||
| 26 | +PduConsts.RET_INVALID_CHALLENGE_RESPONSE = 6; | ||
| 27 | +PduConsts.RET_NO_CONNECTION = 7; | ||
| 28 | +PduConsts.RET_FULL_CAPACITY = 8; | ||
| 29 | + |
src/pdu/PduType.js
0 → 100644
| 1 | +export default function RCPduPackage(targe_type_id) {}; | ||
| 2 | +RCPduPackage.RCPDU_CONNECT_PROVIDER_REQUEST = 0; | ||
| 3 | +RCPduPackage.RCPDU_CONNECT_PROVIDER_RESPONSE = 1; | ||
| 4 | +RCPduPackage.RCPDU_CONFERENCE_JOIN_REQUEST = 2; | ||
| 5 | +RCPduPackage.RCPDU_CONFERENCE_JOIN_RESPONSE = 3; | ||
| 6 | +RCPduPackage.RCPDU_CONFERENCE_INVITE_REQUEST = 10; | ||
| 7 | +RCPduPackage.RCPDU_CONFERENCE_INVITE_RESPONSE = 11; | ||
| 8 | +RCPduPackage.RCPDU_CONFERENCE_LOCK_REQUEST = 20; | ||
| 9 | +RCPduPackage.RCPDU_CONFERENCE_LOCK_RESPONSE = 21; | ||
| 10 | +RCPduPackage.RCPDU_CONFERENCE_LOCK_INDICATION = 22; | ||
| 11 | +RCPduPackage.RCPDU_CONFERENCE_UNLOCK_REQUEST = 30; | ||
| 12 | +RCPduPackage.RCPDU_CONFERENCE_UNLOCK_RESPONSE = 31; | ||
| 13 | +RCPduPackage.RCPDU_CONFERENCE_UNLOCK_INDICATION = 32; | ||
| 14 | +RCPduPackage.RCPDU_CONFERENCE_LEAVE_REQUEST = 39; | ||
| 15 | +RCPduPackage.RCPDU_CONFERENCE_TERMINATE_REQUEST = 40; | ||
| 16 | +RCPduPackage.RCPDU_CONFERENCE_TERMINATE_RESPONSE = 41; | ||
| 17 | +RCPduPackage.RCPDU_CONFERENCE_TERMINATE_INDICATION = 42; | ||
| 18 | +RCPduPackage.RCPDU_CONFERENCE_EJECT_USER_REQUEST = 50; | ||
| 19 | +RCPduPackage.RCPDU_CONFERENCE_EJECT_USER_RESPONSE = 51; | ||
| 20 | +RCPduPackage.RCPDU_CONFERENCE_EJECT_USER_INDICATION = 52; | ||
| 21 | +RCPduPackage.RCPDU_ROSTER_UPDATE_INDICATION = 60; | ||
| 22 | +RCPduPackage.RCPDU_REGISTRY_UPDATE_REQUEST = 70; | ||
| 23 | +RCPduPackage.RCPDU_REGISTRY_UPDATE_RESPONSE = 71; | ||
| 24 | +RCPduPackage.RCPDU_REGISTRY_UPDATE_INDICATION = 72; | ||
| 25 | +RCPduPackage.RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE = 80; | ||
| 26 | +RCPduPackage.RCPDU_SESSION_JOIN_REQUEST = 90; | ||
| 27 | +RCPduPackage.RCPDU_SESSION_JOIN_RESPONSE = 91; | ||
| 28 | +RCPduPackage.RCPDU_CHANNEL_GRAB_REQUEST = 100; | ||
| 29 | +RCPduPackage.RCPDU_CHANNEL_GRAB_RESPONSE = 101; | ||
| 30 | +RCPduPackage.RCPDU_CHANNEL_GRAB_INDICATION = 102; | ||
| 31 | +RCPduPackage.RCPDU_CHANNEL_JOIN_REQUEST = 103; | ||
| 32 | +RCPduPackage.RCPDU_CHANNEL_JOIN_RESPONSE = 104; | ||
| 33 | +RCPduPackage.RCPDU_CHANNEL_LEAVE_REQUEST = 105; | ||
| 34 | +RCPduPackage.RCPDU_CHANNEL_RELEASE_REQUEST = 106; | ||
| 35 | +RCPduPackage.RCPDU_CHANNEL_RELEASE_INDICATION = 107; | ||
| 36 | +RCPduPackage.RCPDU_SEND_DATA_REQUEST = 120; | ||
| 37 | +RCPduPackage.RCPDU_SEND_DATA_REQUEST = 120; | ||
| 38 | +RCPduPackage.RCPDU_SEND_DATA_INDICATION = 121; | ||
| 39 | +RCPduPackage.RCPDU_UNIFORM_SEND_DATA_REQUEST = 125; | ||
| 40 | +RCPduPackage.RCPDU_UNIFORM_SEND_DATA_INDICATION = 126; | ||
| 41 | +RCPduPackage.RCPDU_TOKEN_GRAB_REQUEST = 130; | ||
| 42 | +RCPduPackage.RCPDU_TOKEN_GRAB_CONFIRM = 131; | ||
| 43 | +RCPduPackage.RCPDU_TOKEN_INHIBIT_REQUEST = 132; | ||
| 44 | +RCPduPackage.RCPDU_TOKEN_INHIBIT_CONFIRM = 133; | ||
| 45 | +RCPduPackage.RCPDU_TOKEN_GIVE_REQUEST = 134; | ||
| 46 | +RCPduPackage.RCPDU_TOKEN_GIVE_INDICATION = 135; | ||
| 47 | +RCPduPackage.RCPDU_TOKEN_GIVE_RESPONSE = 136; | ||
| 48 | +RCPduPackage.RCPDU_TOKEN_GIVE_CONFIRM = 137; | ||
| 49 | +RCPduPackage.RCPDU_TOKEN_PLEASE_REQUEST = 138; | ||
| 50 | +RCPduPackage.RCPDU_TOKEN_PLEASE_INDICATION = 139; | ||
| 51 | +RCPduPackage.RCPDU_TOKEN_RELEASE_REQUEST = 140; | ||
| 52 | +RCPduPackage.RCPDU_TOKEN_RELEASE_CONFIRM = 141; | ||
| 53 | +RCPduPackage.RCPDU_TOKEN_TEST_REQUEST = 142; | ||
| 54 | +RCPduPackage.RCPDU_TOKEN_TEST_CONFIRM = 143; | ||
| 55 | +RCPduPackage.RCPDU_REG_REGISTER_KEY = 200; | ||
| 56 | +RCPduPackage.RCPDU_REG_UNREGISTER_KEY = 201; | ||
| 57 | +RCPduPackage.RCPDU_REG_REGISTER_ROSTER = 202; | ||
| 58 | +RCPduPackage.RCPDU_REG_REGISTER_TOKEN = 203; | ||
| 59 | +RCPduPackage.RCPDU_REG_REGISTER_PARAMETER = 204; | ||
| 60 | +RCPduPackage.RCPDU_REG_REGISTER_COUNTER = 205; | ||
| 61 | +RCPduPackage.RCPDU_REG_REGISTER_TABLE = 206; | ||
| 62 | +RCPduPackage.RCPDU_REG_REGISTER_CACHE = 207; | ||
| 63 | +RCPduPackage.RCPDU_REG_REGISTER_OBJ = 208; | ||
| 64 | +RCPduPackage.RCPDU_REG_UNREGISTER_OBJ = 209; | ||
| 65 | +RCPduPackage.RCPDU_REG_UPDATE_OBJ = 210; | ||
| 66 | +RCPduPackage.RCPDU_REG_ADAPTER = 211; | ||
| 67 | +RCPduPackage.RCPDU_REG_CLEANUP_NODE = 212; | ||
| 68 | +RCPduPackage.RCPDU_REG_REGISTER_QUEUE = 213; | ||
| 69 | +RCPduPackage.RCPDU_REG_TABLE_INSERT_PDU = 230; | ||
| 70 | +RCPduPackage.RCPDU_REG_TABLE_DELETE_PDU = 231; | ||
| 71 | +RCPduPackage.RCPDU_REG_TABLE_UPDATE_PDU = 232; | ||
| 72 | +RCPduPackage.RCPDU_REG_ROSTER_INSERT_PDU = 240; | ||
| 73 | +RCPduPackage.RCPDU_REG_ROSTER_DELETE_PDU = 241; | ||
| 74 | +RCPduPackage.RCPDU_REG_ROSTER_UPDATE_PDU = 242; | ||
| 75 | +RCPduPackage.RCPDU_REG_PARAMETER_UPDATE_PDU = 250; | ||
| 76 | +RCPduPackage.RCPDU_REG_QUEUE_INSERT_PDU = 255; | ||
| 77 | +RCPduPackage.RCPDU_REG_QUEUE_DELETE_PDU = 256; | ||
| 78 | +RCPduPackage.RCPDU_REG_QUEUE_UPDATE_PDU = 257; | ||
| 79 | +RCPduPackage.RCPDU_CONFERENCE_SEND_DATA_REQUEST = 259; | ||
| 80 | +RCPduPackage.RCPDU_VIDEO_SEND_DATA_REQUEST = 260; | ||
| 81 | +RCPduPackage.RCPDU_AUDIO_SEND_DATA_REQUEST = 261; | ||
| 82 | +RCPduPackage.RCPDU_GIFT_SEND_DATA_REQUEST = 262; | ||
| 83 | +RCPduPackage.RCPDU_CHAT_SEND_DATA_REQUEST = 263; | ||
| 84 | +RCPduPackage.RCPDU_VOTING_POLL_RECORD = 265; | ||
| 85 | +RCPduPackage.RCPDU_REG_REQUEST_OBJ = 290; | ||
| 86 | +RCPduPackage.RCPDU_REG_RESPONSE_OBJ = 291; | ||
| 87 | +RCPduPackage.RCPDU_REG_COUNTER_REQUEST_PDU = 292; | ||
| 88 | +RCPduPackage.RCPDU_REG_COUNTER_RESPONSE_PDU = 293; | ||
| 89 | +RCPduPackage.RCPDU_INDEX_ADAPTER = 300; | ||
| 90 | +RCPduPackage.RCPDU_INDEX_SERVER_USERS = 301; | ||
| 91 | +RCPduPackage.RCPDU_INDEX_CONFERENCE_USER_JOINED = 302; | ||
| 92 | +RCPduPackage.RCPDU_INDEX_CONFERENCE_USER_EXITED = 303; | ||
| 93 | +RCPduPackage.RCPDU_INDEX_CONFERENCE_USERS = 304; | ||
| 94 | + |
src/pdu/ProBuf.js
0 → 100644
此 diff 太大无法显示。
src/pdu/index.js
0 → 100644
| 1 | +import ProtoBuf from 'protobufjs'; | ||
| 2 | +import pro from './pro'; | ||
| 3 | +import PduType from './PduType'; | ||
| 4 | +import PduConsts from './PduConsts'; | ||
| 5 | + | ||
| 6 | +let builder = ProtoBuf.newBuilder({ convertFieldsToCamelCase: true }); | ||
| 7 | +ProtoBuf.loadProto(pro, builder); | ||
| 8 | + | ||
| 9 | +let pdu = builder.build(); | ||
| 10 | + | ||
| 11 | +// 底层通信层[Firstlayer] - RCSendDataPdu封包 | ||
| 12 | +function create_pdu(type, sub_type, | ||
| 13 | + initiator, conference_id, session_id, | ||
| 14 | + channel_id, upward, reliability, priority, | ||
| 15 | + peer, seg) { | ||
| 16 | + var pduMsg = new pdu['RCSendDataPdu'](); | ||
| 17 | + pduMsg.set("type", type); | ||
| 18 | + pduMsg.set("subType", sub_type); | ||
| 19 | + pduMsg.set("initiator", initiator); | ||
| 20 | + pduMsg.set("confId", conference_id); | ||
| 21 | + pduMsg.set("sessionId", session_id); | ||
| 22 | + pduMsg.set("channelId", channel_id); | ||
| 23 | + pduMsg.set("upward", upward); | ||
| 24 | + pduMsg.set("reliability", reliability); | ||
| 25 | + pduMsg.set("priority", priority); | ||
| 26 | + pduMsg.set("peer", peer); | ||
| 27 | + pduMsg.set("seg", seg); | ||
| 28 | + return pduMsg; | ||
| 29 | +} | ||
| 30 | +// 底层通信层[Firstlayer] - RCSendDataPdu解包 | ||
| 31 | +pdu.decode_pdu = function (buffer) { | ||
| 32 | + return pdu['RCSendDataPdu'].decode(buffer); | ||
| 33 | +}; | ||
| 34 | + | ||
| 35 | +pdu.create_connect_provider_request_pdu = function ( | ||
| 36 | + sub_type, | ||
| 37 | + initiator, | ||
| 38 | + conference_id, | ||
| 39 | + session_id, | ||
| 40 | + channel_id, | ||
| 41 | + reliability, | ||
| 42 | + priority, | ||
| 43 | + peer, | ||
| 44 | + seg | ||
| 45 | +) { | ||
| 46 | + return create_pdu(PduType.RCPDU_CONNECT_PROVIDER_REQUEST, | ||
| 47 | + sub_type, initiator, conference_id, session_id, channel_id, true, | ||
| 48 | + reliability, priority, peer, seg); | ||
| 49 | +}; | ||
| 50 | + | ||
| 51 | +pdu.create_uniform_pdu = function ( | ||
| 52 | + sub_type, | ||
| 53 | + initiator, | ||
| 54 | + conference_id, | ||
| 55 | + session_id, | ||
| 56 | + channel_id, | ||
| 57 | + reliability, | ||
| 58 | + priority, | ||
| 59 | + peer, | ||
| 60 | + seg | ||
| 61 | +) { | ||
| 62 | + return create_pdu(PduType.RCPDU_UNIFORM_SEND_DATA_REQUEST, | ||
| 63 | + sub_type, initiator, conference_id, session_id, channel_id, true, | ||
| 64 | + reliability, priority, peer, seg); | ||
| 65 | +}; | ||
| 66 | + | ||
| 67 | +pdu.create_normal_pdu = function ( | ||
| 68 | + sub_type, | ||
| 69 | + initiator, | ||
| 70 | + conference_id, | ||
| 71 | + session_id, | ||
| 72 | + channel_id, | ||
| 73 | + upward, | ||
| 74 | + reliability, | ||
| 75 | + priority, | ||
| 76 | + peer, | ||
| 77 | + seg | ||
| 78 | +) { | ||
| 79 | + return create_pdu(PduType.RCPDU_SEND_DATA_REQUEST, | ||
| 80 | + sub_type, initiator, conference_id, session_id, channel_id, upward, | ||
| 81 | + reliability, priority, peer, seg); | ||
| 82 | +}; | ||
| 83 | + | ||
| 84 | +pdu.id2type = function (id) { | ||
| 85 | + for (var type_const in PduType) { | ||
| 86 | + if (PduType[type_const] === id) { | ||
| 87 | + return type_const; | ||
| 88 | + } | ||
| 89 | + } | ||
| 90 | +}; | ||
| 91 | + | ||
| 92 | +// 合并统一对外 | ||
| 93 | +pdu = {...pdu, ...PduType, ...PduConsts }; | ||
| 94 | + | ||
| 95 | +export default pdu; | ||
| 96 | + |
src/pdu/pro.js
0 → 100644
| 1 | +export default ` | ||
| 2 | +//start | ||
| 3 | +// pdu_def.proto | ||
| 4 | + | ||
| 5 | +// syntax = "proto3"; | ||
| 6 | + | ||
| 7 | +option optimize_for = LITE_RUNTIME; | ||
| 8 | +enum RCPduPriority_E { | ||
| 9 | + DP_TOP = 0; | ||
| 10 | + DP_HIGH = 1; | ||
| 11 | + DP_MEDIUM = 2; | ||
| 12 | + DP_LOW = 3; | ||
| 13 | +} | ||
| 14 | + | ||
| 15 | +enum RCPduSegment_E { | ||
| 16 | + SEG_BEGIN = 0; | ||
| 17 | + SEG_END = 1; | ||
| 18 | + SEG_ONCE = 2; | ||
| 19 | +} | ||
| 20 | + | ||
| 21 | +enum RCPduTokenStatus_E { | ||
| 22 | + TS_NOT_IN_USE = 0; | ||
| 23 | + TS_SELF_GRABBED = 1; | ||
| 24 | + TS_OTHER_GRABBED = 2; | ||
| 25 | + TS_SELF_INHIBITED = 3; | ||
| 26 | + TS_OTHER_INHIBITED = 4; | ||
| 27 | + TS_SELF_RECIPIENT = 5; | ||
| 28 | + TS_SELF_GIVING = 6; | ||
| 29 | + TS_OTHER_GIVING = 7; | ||
| 30 | +} | ||
| 31 | + | ||
| 32 | +enum RCPduType_E { | ||
| 33 | +// GCC PDU | ||
| 34 | + RCPDU_CONNECT_PROVIDER_REQUEST = 0; | ||
| 35 | + RCPDU_CONNECT_PROVIDER_RESPONSE = 1; | ||
| 36 | + RCPDU_CONFERENCE_JOIN_REQUEST = 2; | ||
| 37 | + RCPDU_CONFERENCE_JOIN_RESPONSE = 3; | ||
| 38 | + RCPDU_CONFERENCE_INVITE_REQUEST = 10; | ||
| 39 | + RCPDU_CONFERENCE_INVITE_RESPONSE = 11; | ||
| 40 | + RCPDU_CONFERENCE_LOCK_REQUEST = 20; | ||
| 41 | + RCPDU_CONFERENCE_LOCK_RESPONSE = 21; | ||
| 42 | + RCPDU_CONFERENCE_LOCK_INDICATION = 22; | ||
| 43 | + RCPDU_CONFERENCE_UNLOCK_REQUEST = 30; | ||
| 44 | + RCPDU_CONFERENCE_UNLOCK_RESPONSE = 31; | ||
| 45 | + RCPDU_CONFERENCE_UNLOCK_INDICATION = 32; | ||
| 46 | + RCPDU_CONFERENCE_LEAVE_REQUEST = 39; | ||
| 47 | + RCPDU_CONFERENCE_TERMINATE_REQUEST = 40; | ||
| 48 | + RCPDU_CONFERENCE_TERMINATE_RESPONSE = 41; | ||
| 49 | + RCPDU_CONFERENCE_TERMINATE_INDICATION = 42; | ||
| 50 | + RCPDU_CONFERENCE_EJECT_USER_REQUEST = 50; | ||
| 51 | + RCPDU_CONFERENCE_EJECT_USER_RESPONSE = 51; | ||
| 52 | + RCPDU_CONFERENCE_EJECT_USER_INDICATION = 52; | ||
| 53 | + RCPDU_ROSTER_UPDATE_INDICATION = 60; | ||
| 54 | + RCPDU_REGISTRY_UPDATE_REQUEST = 70; // INCLUDE ALL OBJS OPERATION | ||
| 55 | + RCPDU_REGISTRY_UPDATE_RESPONSE = 71; | ||
| 56 | + RCPDU_REGISTRY_UPDATE_INDICATION = 72; | ||
| 57 | + RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE = 80; | ||
| 58 | + | ||
| 59 | + // MCS PDU | ||
| 60 | + RCPDU_SESSION_JOIN_REQUEST = 90; | ||
| 61 | + RCPDU_SESSION_JOIN_RESPONSE = 91; | ||
| 62 | + RCPDU_CHANNEL_GRAB_REQUEST = 100; | ||
| 63 | + RCPDU_CHANNEL_GRAB_RESPONSE = 101; | ||
| 64 | + RCPDU_CHANNEL_GRAB_INDICATION = 102; | ||
| 65 | + RCPDU_CHANNEL_JOIN_REQUEST = 103; | ||
| 66 | + RCPDU_CHANNEL_JOIN_RESPONSE = 104; | ||
| 67 | + RCPDU_CHANNEL_LEAVE_REQUEST = 105; | ||
| 68 | + RCPDU_CHANNEL_RELEASE_REQUEST = 106; | ||
| 69 | + RCPDU_CHANNEL_RELEASE_INDICATION = 107; | ||
| 70 | + RCPDU_SEND_DATA_REQUEST = 120; | ||
| 71 | + RCPDU_SEND_DATA_INDICATION = 121; | ||
| 72 | + RCPDU_UNIFORM_SEND_DATA_REQUEST = 125; | ||
| 73 | + RCPDU_UNIFORM_SEND_DATA_INDICATION = 126; | ||
| 74 | + RCPDU_TOKEN_GRAB_REQUEST = 130; | ||
| 75 | + RCPDU_TOKEN_GRAB_CONFIRM = 131; | ||
| 76 | + RCPDU_TOKEN_INHIBIT_REQUEST = 132; | ||
| 77 | + RCPDU_TOKEN_INHIBIT_CONFIRM = 133; | ||
| 78 | + RCPDU_TOKEN_GIVE_REQUEST = 134; | ||
| 79 | + RCPDU_TOKEN_GIVE_INDICATION = 135; | ||
| 80 | + RCPDU_TOKEN_GIVE_RESPONSE = 136; | ||
| 81 | + RCPDU_TOKEN_GIVE_CONFIRM = 137; | ||
| 82 | + RCPDU_TOKEN_PLEASE_REQUEST = 138; | ||
| 83 | + RCPDU_TOKEN_PLEASE_INDICATION = 139; | ||
| 84 | + RCPDU_TOKEN_RELEASE_REQUEST = 140; | ||
| 85 | + RCPDU_TOKEN_RELEASE_CONFIRM = 141; | ||
| 86 | + RCPDU_TOKEN_TEST_REQUEST = 142; | ||
| 87 | + RCPDU_TOKEN_TEST_CONFIRM = 143; | ||
| 88 | + | ||
| 89 | + // Registry PDU | ||
| 90 | + RCPDU_REG_REGISTER_KEY = 200; | ||
| 91 | + RCPDU_REG_UNREGISTER_KEY = 201; | ||
| 92 | + RCPDU_REG_REGISTER_ROSTER = 202; | ||
| 93 | + RCPDU_REG_REGISTER_TOKEN = 203; | ||
| 94 | + RCPDU_REG_REGISTER_PARAMETER = 204; | ||
| 95 | + RCPDU_REG_REGISTER_COUNTER = 205; | ||
| 96 | + RCPDU_REG_REGISTER_TABLE = 206; | ||
| 97 | + RCPDU_REG_REGISTER_CACHE = 207; | ||
| 98 | + RCPDU_REG_REGISTER_OBJ = 208; | ||
| 99 | + RCPDU_REG_UNREGISTER_OBJ = 209; | ||
| 100 | + RCPDU_REG_UPDATE_OBJ = 210; | ||
| 101 | + RCPDU_REG_ADAPTER = 211; | ||
| 102 | + RCPDU_REG_CLEANUP_NODE = 212; | ||
| 103 | + RCPDU_REG_REGISTER_QUEUE = 213; | ||
| 104 | + | ||
| 105 | + // Registry Obj update PDU | ||
| 106 | + RCPDU_REG_TABLE_INSERT_PDU = 230; | ||
| 107 | + RCPDU_REG_TABLE_DELETE_PDU = 231; | ||
| 108 | + RCPDU_REG_TABLE_UPDATE_PDU = 232; | ||
| 109 | + RCPDU_REG_ROSTER_INSERT_PDU = 240; | ||
| 110 | + RCPDU_REG_ROSTER_DELETE_PDU = 241; | ||
| 111 | + RCPDU_REG_ROSTER_UPDATE_PDU = 242; | ||
| 112 | + RCPDU_REG_PARAMETER_UPDATE_PDU = 250; | ||
| 113 | + RCPDU_REG_QUEUE_INSERT_PDU = 255; | ||
| 114 | + RCPDU_REG_QUEUE_DELETE_PDU = 256; | ||
| 115 | + RCPDU_REG_QUEUE_UPDATE_PDU = 257; | ||
| 116 | + | ||
| 117 | + // data | ||
| 118 | + RCPDU_CONFERENCE_SEND_DATA_REQUEST = 259; | ||
| 119 | + RCPDU_VIDEO_SEND_DATA_REQUEST = 260; | ||
| 120 | + RCPDU_AUDIO_SEND_DATA_REQUEST = 261; | ||
| 121 | + RCPDU_GIFT_SEND_DATA_REQUEST = 262; | ||
| 122 | + RCPDU_CHAT_SEND_DATA_REQUEST = 263; | ||
| 123 | + RCPDU_VOTING_POLL_RECORD = 265; | ||
| 124 | + | ||
| 125 | + // Registry resource request or response PDU | ||
| 126 | + RCPDU_REG_REQUEST_OBJ = 290; | ||
| 127 | + RCPDU_REG_RESPONSE_OBJ = 291; | ||
| 128 | + RCPDU_REG_COUNTER_REQUEST_PDU = 292; | ||
| 129 | + RCPDU_REG_COUNTER_RESPONSE_PDU = 293; | ||
| 130 | + | ||
| 131 | + // Index exchange | ||
| 132 | + RCPDU_INDEX_ADAPTER = 300; | ||
| 133 | + RCPDU_INDEX_SERVER_USERS = 301; | ||
| 134 | + RCPDU_INDEX_CONFERENCE_USER_JOINED = 302; | ||
| 135 | + RCPDU_INDEX_CONFERENCE_USER_EXITED = 303; | ||
| 136 | + RCPDU_INDEX_CONFERENCE_USERS = 304; | ||
| 137 | +} | ||
| 138 | + | ||
| 139 | +enum RCPduNodeType_E { | ||
| 140 | + NT_TERMINAL = 0; | ||
| 141 | + NT_MULTIPORT_TERMINAL = 1; | ||
| 142 | + NT_MCU = 2; | ||
| 143 | +} | ||
| 144 | + | ||
| 145 | +enum RCPduReason_E { | ||
| 146 | + RSN_USERINITIATED = 0; | ||
| 147 | + RSN_DISCONNECTED = 1; | ||
| 148 | + RSN_SUPER_LEFT = 2; | ||
| 149 | +} | ||
| 150 | + | ||
| 151 | +enum RCPduResult_E { | ||
| 152 | + RET_SUCCESS = 0; | ||
| 153 | + RET_USER_REJECTED = 1; | ||
| 154 | + RET_INVALID_CONFERENCE = 2; | ||
| 155 | + RET_INVALID_PASSWORD = 3; | ||
| 156 | + RET_INVALID_CONVENER_PASSWORD = 4; | ||
| 157 | + RET_CHALLENGE_RESPONSE_REQUIRED = 5; | ||
| 158 | + RET_INVALID_CHALLENGE_RESPONSE = 6; | ||
| 159 | + RET_NO_CONNECTION = 7; | ||
| 160 | + RET_FULL_CAPACITY = 8; | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +enum RCPduNodeCategory_E { | ||
| 164 | + NC_CONVENTIONAL = 0; | ||
| 165 | + NC_COUNTED = 1; | ||
| 166 | + NC_ANONYMOUS = 2; | ||
| 167 | +} | ||
| 168 | + | ||
| 169 | +message RCConferenceDescriptorPdu { | ||
| 170 | + required uint32 id = 1; | ||
| 171 | + required bytes name = 2; | ||
| 172 | + optional bytes description = 3; | ||
| 173 | + //optional string net_address = 4; | ||
| 174 | + optional uint32 mode = 4; | ||
| 175 | + optional string password = 5; | ||
| 176 | + optional uint32 capacity = 6; | ||
| 177 | + optional bytes user_data = 7; | ||
| 178 | +} | ||
| 179 | + | ||
| 180 | +message RCNodeRecordPdu { | ||
| 181 | + required uint32 id = 1; | ||
| 182 | + optional uint32 superior_node = 2; | ||
| 183 | + required RCPduNodeType_E type = 3; | ||
| 184 | + required string name = 4; | ||
| 185 | + required uint32 capability = 5; | ||
| 186 | + optional string net_address = 6; | ||
| 187 | + optional RCPduNodeCategory_E category = 7; | ||
| 188 | +} | ||
| 189 | + | ||
| 190 | +message RCApplicationRecordPdu { | ||
| 191 | + required uint32 id = 1; // session id | ||
| 192 | + required string name = 2; | ||
| 193 | + required string tag = 3; | ||
| 194 | + repeated uint32 channel_ids = 4 [packed = true]; | ||
| 195 | + optional uint32 capability = 5; | ||
| 196 | +} | ||
| 197 | + | ||
| 198 | +//reg.proto | ||
| 199 | + | ||
| 200 | +option optimize_for = LITE_RUNTIME; | ||
| 201 | +message RCRegistryRegisterKeyPdu { | ||
| 202 | + required RCPduType_E type = 1 [default = RCPDU_REG_REGISTER_KEY]; | ||
| 203 | + required uint32 id = 2; | ||
| 204 | + required string name = 3; | ||
| 205 | + required string tag = 4; | ||
| 206 | + optional bytes user_data = 5; | ||
| 207 | +} | ||
| 208 | + | ||
| 209 | +message RCRegistryUnregisterKeyPdu { | ||
| 210 | + optional RCPduType_E type = 1 [default = RCPDU_REG_UNREGISTER_KEY]; | ||
| 211 | + required uint32 key_id = 2; | ||
| 212 | +} | ||
| 213 | + | ||
| 214 | +message RCRegistryRegisterObjPdu { | ||
| 215 | + optional RCPduType_E type = 1; | ||
| 216 | + required uint32 obj_id = 2; | ||
| 217 | + required string name = 3; | ||
| 218 | + required string tag = 4; | ||
| 219 | + optional uint32 owner = 5; | ||
| 220 | + optional bytes user_data = 6; | ||
| 221 | +} | ||
| 222 | + | ||
| 223 | +message RCRegistryUnregisterObjPdu { | ||
| 224 | + optional RCPduType_E type = 1 [default = RCPDU_REG_UNREGISTER_OBJ]; | ||
| 225 | + required uint32 obj_id = 2; | ||
| 226 | +} | ||
| 227 | + | ||
| 228 | +message RCRegistryUpdateObjPdu { | ||
| 229 | + optional RCPduType_E type = 1 [default = RCPDU_REG_UPDATE_OBJ]; | ||
| 230 | + required RCPduType_E sub_type = 2; | ||
| 231 | + required uint32 obj_id = 3; | ||
| 232 | + required bytes user_data = 4; | ||
| 233 | +} | ||
| 234 | + | ||
| 235 | +message RCAdapterItemPdu { | ||
| 236 | + required RCPduType_E type = 1; | ||
| 237 | + required bytes item_data = 2; | ||
| 238 | +} | ||
| 239 | + | ||
| 240 | +// adapter pdu that used to package a list of pdu. | ||
| 241 | +message RCAdapterPdu { | ||
| 242 | + optional RCPduType_E type = 1 [default = RCPDU_REG_ADAPTER]; | ||
| 243 | + repeated RCAdapterItemPdu item = 2; | ||
| 244 | +} | ||
| 245 | + | ||
| 246 | +// table operation pdu | ||
| 247 | +message RCRegistryTableItemPdu { | ||
| 248 | + required uint32 item_idx = 1; | ||
| 249 | + required uint32 owner = 2; | ||
| 250 | + required bytes item_data = 3; | ||
| 251 | +} | ||
| 252 | + | ||
| 253 | +message RCRegistryTableInsertItemPdu { | ||
| 254 | + optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_INSERT_PDU]; | ||
| 255 | + repeated RCRegistryTableItemPdu items = 2; | ||
| 256 | +} | ||
| 257 | + | ||
| 258 | +message RCRegistryTableDeleteItemPdu { | ||
| 259 | + optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_DELETE_PDU]; | ||
| 260 | + repeated uint32 item_idx = 2; | ||
| 261 | +} | ||
| 262 | + | ||
| 263 | +message RCRegistryTableUpdateItemPdu { | ||
| 264 | + optional RCPduType_E type = 1 [default = RCPDU_REG_TABLE_UPDATE_PDU]; | ||
| 265 | + repeated RCRegistryTableItemPdu items = 2; | ||
| 266 | +} | ||
| 267 | + | ||
| 268 | +// roster operation pdu | ||
| 269 | +message RCRegistryRosterItemPdu { | ||
| 270 | + required uint32 node_id = 1; | ||
| 271 | + required bytes node_data = 2; | ||
| 272 | +} | ||
| 273 | + | ||
| 274 | +message RCRegistryRosterInsertItemPdu { | ||
| 275 | + optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_INSERT_PDU]; | ||
| 276 | + repeated RCRegistryRosterItemPdu items = 2; | ||
| 277 | +} | ||
| 278 | + | ||
| 279 | +message RCRegistryRosterDeleteItemPdu { | ||
| 280 | + optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_DELETE_PDU]; | ||
| 281 | + required uint32 node_id = 2; | ||
| 282 | +} | ||
| 283 | + | ||
| 284 | +message RCRegistryRosterUpdateItemPdu { | ||
| 285 | + optional RCPduType_E type = 1 [default = RCPDU_REG_ROSTER_UPDATE_PDU]; | ||
| 286 | + repeated RCRegistryRosterItemPdu items = 2; | ||
| 287 | +} | ||
| 288 | + | ||
| 289 | +//message RCCleanupNodePdu | ||
| 290 | +//{ | ||
| 291 | +// optional RCPduType_E type = 1 [default = RCPDU_REG_CLEANUP_NODE]; | ||
| 292 | +// required uint32 node_id = 2; | ||
| 293 | +//} | ||
| 294 | + | ||
| 295 | +// parameter operation pdu | ||
| 296 | +message RCRegistryParameterUpdatePdu { | ||
| 297 | + optional RCPduType_E type = 1 [default = RCPDU_REG_PARAMETER_UPDATE_PDU]; | ||
| 298 | + required uint32 value = 2 [default = 0]; | ||
| 299 | + optional uint32 begin_bit = 3 [default = 31]; | ||
| 300 | + optional uint32 end_bit = 4; | ||
| 301 | +} | ||
| 302 | + | ||
| 303 | +// queue operation pdu | ||
| 304 | +message RCRegistryQueueItemPdu { | ||
| 305 | + required uint32 owner = 1; | ||
| 306 | + required uint32 item_id = 2; | ||
| 307 | + optional bytes item_data = 3; | ||
| 308 | + optional uint32 item_idx = 4; | ||
| 309 | +} | ||
| 310 | + | ||
| 311 | +message RCRegstryQueueInsertItemPdu { | ||
| 312 | + optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_INSERT_PDU]; | ||
| 313 | + repeated RCRegistryQueueItemPdu items = 2; | ||
| 314 | +} | ||
| 315 | + | ||
| 316 | +message RCRegistryQueueDeleteItemPdu { | ||
| 317 | + optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_DELETE_PDU]; | ||
| 318 | + required uint32 item_id = 2; | ||
| 319 | +} | ||
| 320 | + | ||
| 321 | +message RCRegistryQueueUpdateItemPdu { | ||
| 322 | + optional RCPduType_E type = 1 [default = RCPDU_REG_QUEUE_UPDATE_PDU]; | ||
| 323 | + repeated RCRegistryQueueItemPdu items = 2; | ||
| 324 | +} | ||
| 325 | + | ||
| 326 | +message RCRegistryRequestObjPdu { | ||
| 327 | + optional RCPduType_E type = 1 [default = RCPDU_REG_REQUEST_OBJ]; | ||
| 328 | + required RCPduType_E sub_type = 2; | ||
| 329 | + required uint32 obj_id = 3; | ||
| 330 | + required bytes user_data = 4; | ||
| 331 | +} | ||
| 332 | + | ||
| 333 | +message RCRegistryResponseObjPdu { | ||
| 334 | + optional RCPduType_E type = 1 [default = RCPDU_REG_RESPONSE_OBJ]; | ||
| 335 | + required RCPduType_E sub_type = 2; | ||
| 336 | + required uint32 obj_id = 3; | ||
| 337 | + required bytes user_data = 4; | ||
| 338 | +} | ||
| 339 | + | ||
| 340 | +message RCRegistryCounterRequestPdu { | ||
| 341 | + optional RCPduType_E type = 1 [default = RCPDU_REG_COUNTER_REQUEST_PDU]; | ||
| 342 | + required uint32 count = 2; | ||
| 343 | +} | ||
| 344 | + | ||
| 345 | +message RCRegistryCounterResponsePdu { | ||
| 346 | + optional RCPduType_E type = 1 [default = RCPDU_REG_COUNTER_RESPONSE_PDU]; | ||
| 347 | + required uint32 start = 2; | ||
| 348 | + required uint32 end = 3; | ||
| 349 | +} | ||
| 350 | + | ||
| 351 | +// mcs | ||
| 352 | +option optimize_for = LITE_RUNTIME; | ||
| 353 | + | ||
| 354 | +// Session management | ||
| 355 | +message RCSessionJoinRequestPdu { | ||
| 356 | + required RCPduType_E type = 1 [default = RCPDU_SESSION_JOIN_REQUEST]; | ||
| 357 | + required uint32 id = 2; | ||
| 358 | + required string name = 3; | ||
| 359 | + required string tag = 4; | ||
| 360 | + optional bytes session_data = 5; //聚合在一起的registry信息 | ||
| 361 | +} | ||
| 362 | + | ||
| 363 | +message RCSessionJoinResponsePdu { | ||
| 364 | + optional RCPduType_E type = 1 [default = RCPDU_SESSION_JOIN_RESPONSE]; | ||
| 365 | + required uint32 id = 2; | ||
| 366 | + optional bytes response_data = 3; | ||
| 367 | +} | ||
| 368 | + | ||
| 369 | +// Channel management | ||
| 370 | +message RCChannelGrabRequestPdu { | ||
| 371 | + optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_REQUEST]; | ||
| 372 | + required uint32 initiator = 2; | ||
| 373 | + required uint32 channel_id = 3; | ||
| 374 | +} | ||
| 375 | + | ||
| 376 | +message RCChannelGrabResponsePdu { | ||
| 377 | + optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_RESPONSE]; | ||
| 378 | + required uint32 initiator = 2; | ||
| 379 | + required uint32 requested_channel_id = 3; | ||
| 380 | + required RCPduResult_E result = 4; | ||
| 381 | + optional uint32 channel_id = 5; | ||
| 382 | +} | ||
| 383 | + | ||
| 384 | +message RCChannelGrabIndicationPdu { | ||
| 385 | + optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_GRAB_INDICATION]; | ||
| 386 | + required uint32 initiator = 2; | ||
| 387 | + optional uint32 channel_id = 3; | ||
| 388 | +} | ||
| 389 | + | ||
| 390 | +message RCChannelJoinRequestPdu { | ||
| 391 | + required RCPduType_E type = 1 [default = RCPDU_CHANNEL_JOIN_REQUEST]; | ||
| 392 | + required uint32 initiator = 2; | ||
| 393 | + required uint32 channel_id = 3; | ||
| 394 | +} | ||
| 395 | + | ||
| 396 | +message RCChannelJoinResponsePdu { | ||
| 397 | + optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_JOIN_RESPONSE]; | ||
| 398 | + required uint32 initiator = 2; | ||
| 399 | + required uint32 requested_channel_id = 3; | ||
| 400 | + required RCPduResult_E result = 4; | ||
| 401 | +} | ||
| 402 | + | ||
| 403 | +message RCChannelLeaveRequestPdu { | ||
| 404 | + optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_LEAVE_REQUEST]; | ||
| 405 | + required uint32 initiator = 2; | ||
| 406 | + repeated uint32 channel_ids = 3 [packed = true]; | ||
| 407 | +} | ||
| 408 | + | ||
| 409 | +message RCChannelReleaseRequestPdu { | ||
| 410 | + optional RCPduType_E type = 1 [default = RCPDU_CHANNEL_RELEASE_REQUEST]; | ||
| 411 | + required uint32 initiator = 2; | ||
| 412 | + required uint32 channel_id = 3; | ||
| 413 | +} | ||
| 414 | + | ||
| 415 | +message RCChannelReleaseIndicationPdu { | ||
| 416 | + optional RCPduType_E type = 1 | ||
| 417 | + [default = RCPDU_CHANNEL_RELEASE_INDICATION]; | ||
| 418 | + required uint32 initiator = 2; | ||
| 419 | + required uint32 channel_id = 3; | ||
| 420 | +} | ||
| 421 | + | ||
| 422 | +// Data transfer | ||
| 423 | +message RCSendDataPdu { | ||
| 424 | + required RCPduType_E type = 1 [default = RCPDU_SEND_DATA_REQUEST]; | ||
| 425 | + required RCPduType_E sub_type = 2; | ||
| 426 | + required uint32 initiator = 3; | ||
| 427 | + required uint32 conf_id = 4; | ||
| 428 | + required uint32 session_id = 5; | ||
| 429 | + required uint32 channel_id = 6; | ||
| 430 | + required bool upward = 7; | ||
| 431 | + required bool reliability = 8; | ||
| 432 | + required RCPduPriority_E priority = 9; | ||
| 433 | + required bytes data = 10; | ||
| 434 | + optional uint32 peer = 11; | ||
| 435 | + optional RCPduSegment_E seg = 12; | ||
| 436 | + optional uint32 total_size = 13; | ||
| 437 | + optional uint32 site_id = 14; | ||
| 438 | + optional string user_id = 15; | ||
| 439 | + optional string user_name = 16; | ||
| 440 | + optional string user_role = 17; | ||
| 441 | + optional string device_type = 18; | ||
| 442 | + optional string site = 19; | ||
| 443 | +} | ||
| 444 | + | ||
| 445 | +// Token management | ||
| 446 | +message RCTokenGrabRequestPdu { | ||
| 447 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GRAB_REQUEST]; | ||
| 448 | + required uint32 initiator = 2; | ||
| 449 | + required uint32 token_id = 3; | ||
| 450 | +} | ||
| 451 | + | ||
| 452 | +message RCTokenGrabConfirmPdu { | ||
| 453 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GRAB_CONFIRM]; | ||
| 454 | + required uint32 initiator = 2; | ||
| 455 | + required uint32 token_id = 3; | ||
| 456 | + required RCPduResult_E result = 4; | ||
| 457 | + required RCPduTokenStatus_E status = 5; | ||
| 458 | +} | ||
| 459 | + | ||
| 460 | +message RCTokenInhibitRequestPdu { | ||
| 461 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_INHIBIT_REQUEST]; | ||
| 462 | + required uint32 initiator = 2; | ||
| 463 | + required uint32 token_id = 3; | ||
| 464 | +} | ||
| 465 | + | ||
| 466 | +message RCTokenInhibitConfirmPdu { | ||
| 467 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_INHIBIT_CONFIRM]; | ||
| 468 | + required uint32 initiator = 2; | ||
| 469 | + required uint32 token_id = 3; | ||
| 470 | + required RCPduResult_E result = 4; | ||
| 471 | + required RCPduTokenStatus_E status = 5; | ||
| 472 | +} | ||
| 473 | + | ||
| 474 | +message RCTokenGiveRequestPdu { | ||
| 475 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_REQUEST]; | ||
| 476 | + required uint32 initiator = 2; | ||
| 477 | + required uint32 token_id = 3; | ||
| 478 | + required uint64 recipient = 4; | ||
| 479 | +} | ||
| 480 | + | ||
| 481 | +message RCTokenGiveIndicationPdu { | ||
| 482 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_INDICATION]; | ||
| 483 | + required uint32 initiator = 2; | ||
| 484 | + required uint32 token_id = 3; | ||
| 485 | + required uint64 recipient = 4; | ||
| 486 | +} | ||
| 487 | + | ||
| 488 | +message RCTokenGiveResponsePdu { | ||
| 489 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_RESPONSE]; | ||
| 490 | + required uint32 token_id = 2; | ||
| 491 | + required uint64 recipient = 3; | ||
| 492 | + required RCPduResult_E result = 4; | ||
| 493 | +} | ||
| 494 | + | ||
| 495 | +message RCTokenGiveConfirmPdu { | ||
| 496 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_GIVE_CONFIRM]; | ||
| 497 | + required uint32 token_id = 2; | ||
| 498 | + required uint64 recipient = 3; | ||
| 499 | + required RCPduResult_E result = 4; | ||
| 500 | + required RCPduTokenStatus_E status = 5; | ||
| 501 | +} | ||
| 502 | + | ||
| 503 | +message RCTokenPleaseRequestPdu { | ||
| 504 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_PLEASE_REQUEST]; | ||
| 505 | + required uint32 initiator = 2; | ||
| 506 | + required uint32 token_id = 3; | ||
| 507 | +} | ||
| 508 | + | ||
| 509 | +message RCTokenPleaseIndicationPdu { | ||
| 510 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_PLEASE_INDICATION]; | ||
| 511 | + required uint32 initiator = 2; | ||
| 512 | + required uint32 token_id = 3; | ||
| 513 | +} | ||
| 514 | + | ||
| 515 | +message RCTokenReleaseRequestPdu { | ||
| 516 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_RELEASE_REQUEST]; | ||
| 517 | + required uint32 initiator = 2; | ||
| 518 | + required uint32 token_id = 3; | ||
| 519 | +} | ||
| 520 | + | ||
| 521 | +message RCTokenReleaseConfirmPdu { | ||
| 522 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_REQUEST]; | ||
| 523 | + required uint32 initiator = 2; | ||
| 524 | + required uint32 token_id = 3; | ||
| 525 | + required RCPduResult_E result = 4; | ||
| 526 | + required RCPduTokenStatus_E status = 5; | ||
| 527 | +} | ||
| 528 | + | ||
| 529 | +message RCTokenTestRequestPdu { | ||
| 530 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_REQUEST]; | ||
| 531 | + required uint32 initiator = 2; | ||
| 532 | + required uint32 token_id = 3; | ||
| 533 | +} | ||
| 534 | + | ||
| 535 | +message RCTokenTestConfirmPdu { | ||
| 536 | + optional RCPduType_E type = 1 [default = RCPDU_TOKEN_TEST_CONFIRM]; | ||
| 537 | + required uint32 initiator = 2; | ||
| 538 | + required uint32 token_id = 3; | ||
| 539 | + required RCPduTokenStatus_E status = 4; | ||
| 540 | +} | ||
| 541 | + | ||
| 542 | +//gcc.proto | ||
| 543 | + | ||
| 544 | +option optimize_for = LITE_RUNTIME; | ||
| 545 | +message RCConferenceJoinRequestPdu { | ||
| 546 | + required RCPduType_E type = 1 [default = RCPDU_CONFERENCE_JOIN_REQUEST]; | ||
| 547 | + required uint32 initiator = 2; | ||
| 548 | + required RCPduNodeType_E node_type = 3; | ||
| 549 | + required RCConferenceDescriptorPdu conf_desc = 4; | ||
| 550 | +} | ||
| 551 | + | ||
| 552 | +message RCConferenceJoinResponsePdu { | ||
| 553 | + optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_JOIN_RESPONSE]; | ||
| 554 | + required uint32 conf_id = 2; | ||
| 555 | + required RCPduResult_E result = 3; | ||
| 556 | + optional RCConferenceDescriptorPdu conf_desc = 4; | ||
| 557 | +} | ||
| 558 | + | ||
| 559 | +message RCConferenceInviteRequestPdu { | ||
| 560 | + optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_INVITE_REQUEST]; | ||
| 561 | + required uint32 initiator = 2; | ||
| 562 | + required RCConferenceDescriptorPdu conf_desc = 3; | ||
| 563 | +} | ||
| 564 | + | ||
| 565 | +message RCConferenceInviteResponsePdu { | ||
| 566 | + optional RCPduType_E type = 1 | ||
| 567 | + [default = RCPDU_CONFERENCE_INVITE_RESPONSE]; | ||
| 568 | + required RCPduResult_E result = 2; | ||
| 569 | + optional bytes user_data = 3; | ||
| 570 | +} | ||
| 571 | + | ||
| 572 | +message RCConferenceLockRequestPdu { | ||
| 573 | + optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LOCK_REQUEST]; | ||
| 574 | +} | ||
| 575 | + | ||
| 576 | +message RCConferenceLockResponsePdu { | ||
| 577 | + optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LOCK_RESPONSE]; | ||
| 578 | + required RCPduResult_E result = 2; | ||
| 579 | +} | ||
| 580 | + | ||
| 581 | +message RCConferenceLockIndicationPdu { | ||
| 582 | + optional RCPduType_E type = 1 | ||
| 583 | + [default = RCPDU_CONFERENCE_LOCK_INDICATION]; | ||
| 584 | +} | ||
| 585 | + | ||
| 586 | +message RCConferenceUnlockRequestPdu { | ||
| 587 | + optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_UNLOCK_REQUEST]; | ||
| 588 | +} | ||
| 589 | + | ||
| 590 | +message RCConferenceUnlockResponsePdu { | ||
| 591 | + optional RCPduType_E type = 1 | ||
| 592 | + [default = RCPDU_CONFERENCE_UNLOCK_RESPONSE]; | ||
| 593 | + required RCPduResult_E result = 2; | ||
| 594 | +} | ||
| 595 | + | ||
| 596 | +message RCConferenceUnlockIndicationPdu { | ||
| 597 | + optional RCPduType_E type = 1 | ||
| 598 | + [default = RCPDU_CONFERENCE_UNLOCK_INDICATION]; | ||
| 599 | +} | ||
| 600 | + | ||
| 601 | +message RCConferenceLeaveRequestPdu { | ||
| 602 | + optional RCPduType_E type = 1 [default = RCPDU_CONFERENCE_LEAVE_REQUEST]; | ||
| 603 | + required RCPduReason_E reason = 2; | ||
| 604 | +} | ||
| 605 | + | ||
| 606 | +message RCConferenceTerminateRequestPdu { | ||
| 607 | + optional RCPduType_E type = 1 | ||
| 608 | + [default = RCPDU_CONFERENCE_TERMINATE_REQUEST]; | ||
| 609 | + required RCPduReason_E reason = 2; | ||
| 610 | +} | ||
| 611 | + | ||
| 612 | +message RCConferenceTerminateResponsePdu { | ||
| 613 | + optional RCPduType_E type = 1 | ||
| 614 | + [default = RCPDU_CONFERENCE_TERMINATE_RESPONSE]; | ||
| 615 | + required RCPduResult_E result = 2; | ||
| 616 | +} | ||
| 617 | + | ||
| 618 | +message RCConferenceTerminateIndicationPdu { // MCS_Uniform_Send_Data on GCC_Broadcast_Channel | ||
| 619 | + optional RCPduType_E type = 1 | ||
| 620 | + [default = RCPDU_CONFERENCE_TERMINATE_INDICATION]; | ||
| 621 | + required RCPduReason_E reason = 2; | ||
| 622 | +} | ||
| 623 | + | ||
| 624 | +message RCConferenceEjectUserRequestPdu { // MCS_Send_Data on Node ID Channel of Top GCC | ||
| 625 | + optional RCPduType_E type = 1 | ||
| 626 | + [default = RCPDU_CONFERENCE_EJECT_USER_REQUEST]; | ||
| 627 | + required uint32 ejected_node_id = 2; | ||
| 628 | + required RCPduReason_E reason = 3; | ||
| 629 | +} | ||
| 630 | + | ||
| 631 | +message RCConferenceEjectUserResponsePdu { // MCS_Send_Data on Node ID Channel of requester | ||
| 632 | + optional RCPduType_E type = 1 | ||
| 633 | + [default = RCPDU_CONFERENCE_EJECT_USER_RESPONSE]; | ||
| 634 | + required uint32 ejected_node_id = 2; | ||
| 635 | + required RCPduResult_E result = 3; | ||
| 636 | +} | ||
| 637 | + | ||
| 638 | +message RCConferenceEjectUserIndicationPdu { // MCS_Uniform_Send_Data on GCC_Broadcast_Channel | ||
| 639 | + optional RCPduType_E type = 1 | ||
| 640 | + [default = RCPDU_CONFERENCE_EJECT_USER_INDICATION]; | ||
| 641 | + required uint32 ejected_node_id = 2; | ||
| 642 | + required RCPduReason_E reason = 3; | ||
| 643 | +} | ||
| 644 | + | ||
| 645 | +message RCRosterUpdateIndicationPdu { // MCS_Send_Data on Node ID Channel or | ||
| 646 | +// MCS_Uniform_Send_Data on GCC_Broadcast_Channel | ||
| 647 | + optional RCPduType_E type = 1 [default = RCPDU_ROSTER_UPDATE_INDICATION]; | ||
| 648 | + required bool full_refresh = 2; // Conference Roster and all | ||
| 649 | + repeated RCNodeRecordPdu node_record = 3; | ||
| 650 | + repeated RCApplicationRecordPdu app_record = 4; | ||
| 651 | +} | ||
| 652 | + | ||
| 653 | +message RCRegistryUpdateRequestPdu { // MCS_Send_Data on Node ID Channel of Top GCC | ||
| 654 | + optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_REQUEST]; | ||
| 655 | + required uint32 key_id = 2; | ||
| 656 | + required uint32 obj_id = 3; | ||
| 657 | + required bytes user_data = 4; | ||
| 658 | +} | ||
| 659 | + | ||
| 660 | +message RCRegistryUpdateIndicationPdu { // MCS_Send_Data on Node ID Channel of Top GCC | ||
| 661 | + optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_RESPONSE]; | ||
| 662 | + required uint32 key_id = 2; | ||
| 663 | + required uint32 obj_id = 3; | ||
| 664 | + required bytes user_data = 4; | ||
| 665 | +} | ||
| 666 | + | ||
| 667 | +message RCRegistryUpdateResponsePdu { // MCS_Send_Data on Node ID Channel of requester | ||
| 668 | + optional RCPduType_E type = 1 [default = RCPDU_REGISTRY_UPDATE_INDICATION]; | ||
| 669 | + required uint32 key_id = 2; | ||
| 670 | + required uint32 obj_id = 3; | ||
| 671 | + required RCPduResult_E result = 4; | ||
| 672 | +} | ||
| 673 | + | ||
| 674 | +message RCFunctionNotSupportedResponsePdu { | ||
| 675 | + optional RCPduType_E type = 1 | ||
| 676 | + [default = RCPDU_FUNCTION_NOT_SUPPORTED_RESPONSE]; | ||
| 677 | + required uint32 request_pdu_id = 2; | ||
| 678 | +} | ||
| 679 | + | ||
| 680 | +//ape.proto | ||
| 681 | + | ||
| 682 | +option optimize_for = LITE_RUNTIME; | ||
| 683 | +message RCConferenceSendDataRequestPdu { | ||
| 684 | + optional uint32 initiator = 1; | ||
| 685 | + optional uint32 peer = 2; | ||
| 686 | + required bool is_public = 3; | ||
| 687 | + required bytes user_data = 4; | ||
| 688 | +} | ||
| 689 | + | ||
| 690 | +message RCChatSendDataRequestPdu { | ||
| 691 | + optional uint32 initiator = 1; | ||
| 692 | + optional uint32 peer = 2; | ||
| 693 | + required bool is_public = 3; | ||
| 694 | + required bytes user_data = 4; | ||
| 695 | + required uint32 from_role = 5; | ||
| 696 | + required bytes from_name = 6; | ||
| 697 | +} | ||
| 698 | + | ||
| 699 | +message RCChatSendH5DataRequestPdu { | ||
| 700 | + optional uint32 initiator = 1; | ||
| 701 | + optional uint32 peer = 2; | ||
| 702 | + required bool is_public = 3; | ||
| 703 | + required string user_data = 4; | ||
| 704 | + required string from_role = 5; | ||
| 705 | + required string from_name = 6; | ||
| 706 | +} | ||
| 707 | + | ||
| 708 | +message RCDocSendDataRequestPdu { | ||
| 709 | + required int32 id = 1; | ||
| 710 | + required string doc_type = 2; | ||
| 711 | + required string uri = 3; | ||
| 712 | + optional int32 owner = 4; | ||
| 713 | + optional int32 from = 5; | ||
| 714 | + optional string name = 6; | ||
| 715 | + optional int32 cur_page_no = 7; | ||
| 716 | + optional int32 cur_H = 8; | ||
| 717 | + optional int32 cur_V = 9; | ||
| 718 | + optional int32 scale = 10; | ||
| 719 | + optional int32 page_num = 11; | ||
| 720 | +} | ||
| 721 | + | ||
| 722 | +message RCGiftSendDataRequestPdu { | ||
| 723 | + optional uint32 initiator = 1; | ||
| 724 | + required uint32 peer = 2; | ||
| 725 | + required uint32 index = 3; | ||
| 726 | + required uint32 num = 4; | ||
| 727 | + optional bytes user_data = 5; | ||
| 728 | +} | ||
| 729 | + | ||
| 730 | +message RCAudioSendDataRequestPdu { | ||
| 731 | + optional uint32 initiator = 1; | ||
| 732 | + required bytes user_data = 2; | ||
| 733 | +} | ||
| 734 | + | ||
| 735 | +message RCVideoSendDataRequestPdu { | ||
| 736 | + optional uint32 initiator = 1; | ||
| 737 | + required bool key_frame = 2; | ||
| 738 | + required uint32 sequence_id = 3; | ||
| 739 | + required uint32 slice_id = 4; | ||
| 740 | + required bytes user_data = 5; | ||
| 741 | +} | ||
| 742 | + | ||
| 743 | +message RCAudioChannelInfoRecordPdu { | ||
| 744 | + required uint32 status = 1; | ||
| 745 | + required uint32 device_id = 2; | ||
| 746 | + required uint32 framerate = 3; | ||
| 747 | + required uint32 bitrate = 4; | ||
| 748 | + required uint32 codec = 5; | ||
| 749 | +} | ||
| 750 | + | ||
| 751 | +message RCVideoChannelInfoRecordPdu { | ||
| 752 | + optional uint32 status = 1; | ||
| 753 | + optional uint32 device_id = 2; | ||
| 754 | + optional uint32 width = 3; | ||
| 755 | + optional uint32 height = 4; | ||
| 756 | + optional uint32 framerate = 5; | ||
| 757 | + optional uint32 bitrate = 6; | ||
| 758 | + optional uint32 codec = 7; | ||
| 759 | + optional string peer_id = 8; | ||
| 760 | + optional string url = 9; | ||
| 761 | + optional uint32 type = 10; | ||
| 762 | + optional string shamlive = 11; | ||
| 763 | + optional uint32 livetype = 12; | ||
| 764 | + optional uint32 releaseGrab = 13; | ||
| 765 | + optional string curTime = 14; | ||
| 766 | +} | ||
| 767 | + | ||
| 768 | +message RCAudioDeviceInfoRecordPdu { | ||
| 769 | + required uint32 device_id = 1; | ||
| 770 | + required string device_name = 2; | ||
| 771 | +} | ||
| 772 | + | ||
| 773 | +message RCVideoDeviceInfoRecordPdu { | ||
| 774 | + required uint32 device_id = 1; | ||
| 775 | + required string device_name = 2; | ||
| 776 | +} | ||
| 777 | + | ||
| 778 | +message RCNodeInfoRecordPdu { | ||
| 779 | + required uint32 node_id = 1; | ||
| 780 | + required string name = 2; | ||
| 781 | + required uint32 role = 3; | ||
| 782 | + required uint32 level = 4; | ||
| 783 | + repeated RCAudioDeviceInfoRecordPdu audio_records = 5; | ||
| 784 | + repeated RCVideoDeviceInfoRecordPdu video_records = 6; | ||
| 785 | + optional uint32 status = 7; | ||
| 786 | + optional bytes user_data = 8; | ||
| 787 | + optional string user_id = 9; | ||
| 788 | + optional uint32 handUpTime = 10; | ||
| 789 | + optional uint32 deviceType = 11; | ||
| 790 | + optional uint32 mobileDirection = 12; | ||
| 791 | +} | ||
| 792 | + | ||
| 793 | +message RCVotingPollSettingsPdu { | ||
| 794 | + required bool timer = 1; | ||
| 795 | + optional uint32 time_limit = 2; | ||
| 796 | + optional uint32 total_score = 3; | ||
| 797 | +} | ||
| 798 | + | ||
| 799 | +message RCVotingPollResultPdu { | ||
| 800 | + required string title = 1; | ||
| 801 | + required string content = 2; | ||
| 802 | + optional uint32 score = 3; | ||
| 803 | +} | ||
| 804 | + | ||
| 805 | +message RCVotingPollQuestionPdu { | ||
| 806 | + required uint32 index = 1; | ||
| 807 | + required uint32 type = 2; | ||
| 808 | + required string title = 3; | ||
| 809 | + repeated string options = 4; | ||
| 810 | + optional uint32 score = 5; | ||
| 811 | + optional uint32 time_limit = 6; | ||
| 812 | + optional string restrict_input = 7; | ||
| 813 | + optional uint32 char_limit = 8; | ||
| 814 | + optional string answer = 9; | ||
| 815 | + repeated uint32 selections = 10; | ||
| 816 | + repeated string responses = 11; | ||
| 817 | +} | ||
| 818 | + | ||
| 819 | +message RCVotingPollRecordPdu { | ||
| 820 | + required RCVotingPollSettingsPdu settings = 1; | ||
| 821 | + required string title = 2; | ||
| 822 | + repeated RCVotingPollResultPdu results = 3; | ||
| 823 | + repeated RCVotingPollQuestionPdu questions = 4; | ||
| 824 | +} | ||
| 825 | + | ||
| 826 | +message RCNodeInfoUserDataPdu { | ||
| 827 | + optional string qq = 1; | ||
| 828 | + optional string skype = 2; | ||
| 829 | + optional string mobile = 3; | ||
| 830 | +} | ||
| 831 | + | ||
| 832 | +message RCWhiteboardDataRequestPdu { | ||
| 833 | + required uint32 id = 1; | ||
| 834 | + required uint32 type = 2; | ||
| 835 | + required uint32 initiator = 3; | ||
| 836 | + optional bytes action = 4; | ||
| 837 | + optional uint32 uncomprLen = 5; | ||
| 838 | +} | ||
| 839 | + | ||
| 840 | +message RCTabUpdateDataRequestPdu { | ||
| 841 | + optional uint32 id = 1; | ||
| 842 | + optional bytes action = 2; | ||
| 843 | + optional uint32 uncomprLen =3; | ||
| 844 | +} | ||
| 845 | + | ||
| 846 | + | ||
| 847 | + | ||
| 848 | +//end | ||
| 849 | +`; | ||
| 850 | + |
src/url.js
0 → 100644
src/zlib.min.js
0 → 100644
| 1 | +/** @license zlib.js 2012 - imaya [ https://github.com/imaya/zlib.js ] The MIT License */(function() {'use strict';function l(d){throw d;}var v=void 0,x=!0,aa=this;function D(d,a){var c=d.split("."),e=aa;!(c[0]in e)&&e.execScript&&e.execScript("var "+c[0]);for(var b;c.length&&(b=c.shift());)!c.length&&a!==v?e[b]=a:e=e[b]?e[b]:e[b]={}};var F="undefined"!==typeof Uint8Array&&"undefined"!==typeof Uint16Array&&"undefined"!==typeof Uint32Array&&"undefined"!==typeof DataView;function H(d,a){this.index="number"===typeof a?a:0;this.i=0;this.buffer=d instanceof(F?Uint8Array:Array)?d:new (F?Uint8Array:Array)(32768);2*this.buffer.length<=this.index&&l(Error("invalid index"));this.buffer.length<=this.index&&this.f()}H.prototype.f=function(){var d=this.buffer,a,c=d.length,e=new (F?Uint8Array:Array)(c<<1);if(F)e.set(d);else for(a=0;a<c;++a)e[a]=d[a];return this.buffer=e}; | ||
| 2 | +H.prototype.d=function(d,a,c){var e=this.buffer,b=this.index,f=this.i,g=e[b],h;c&&1<a&&(d=8<a?(N[d&255]<<24|N[d>>>8&255]<<16|N[d>>>16&255]<<8|N[d>>>24&255])>>32-a:N[d]>>8-a);if(8>a+f)g=g<<a|d,f+=a;else for(h=0;h<a;++h)g=g<<1|d>>a-h-1&1,8===++f&&(f=0,e[b++]=N[g],g=0,b===e.length&&(e=this.f()));e[b]=g;this.buffer=e;this.i=f;this.index=b};H.prototype.finish=function(){var d=this.buffer,a=this.index,c;0<this.i&&(d[a]<<=8-this.i,d[a]=N[d[a]],a++);F?c=d.subarray(0,a):(d.length=a,c=d);return c}; | ||
| 3 | +var fa=new (F?Uint8Array:Array)(256),O;for(O=0;256>O;++O){for(var P=O,Q=P,ga=7,P=P>>>1;P;P>>>=1)Q<<=1,Q|=P&1,--ga;fa[O]=(Q<<ga&255)>>>0}var N=fa;function ha(d){this.buffer=new (F?Uint16Array:Array)(2*d);this.length=0}ha.prototype.getParent=function(d){return 2*((d-2)/4|0)};ha.prototype.push=function(d,a){var c,e,b=this.buffer,f;c=this.length;b[this.length++]=a;for(b[this.length++]=d;0<c;)if(e=this.getParent(c),b[c]>b[e])f=b[c],b[c]=b[e],b[e]=f,f=b[c+1],b[c+1]=b[e+1],b[e+1]=f,c=e;else break;return this.length}; | ||
| 4 | +ha.prototype.pop=function(){var d,a,c=this.buffer,e,b,f;a=c[0];d=c[1];this.length-=2;c[0]=c[this.length];c[1]=c[this.length+1];for(f=0;;){b=2*f+2;if(b>=this.length)break;b+2<this.length&&c[b+2]>c[b]&&(b+=2);if(c[b]>c[f])e=c[f],c[f]=c[b],c[b]=e,e=c[f+1],c[f+1]=c[b+1],c[b+1]=e;else break;f=b}return{index:d,value:a,length:this.length}};function R(d){var a=d.length,c=0,e=Number.POSITIVE_INFINITY,b,f,g,h,k,n,q,r,p,m;for(r=0;r<a;++r)d[r]>c&&(c=d[r]),d[r]<e&&(e=d[r]);b=1<<c;f=new (F?Uint32Array:Array)(b);g=1;h=0;for(k=2;g<=c;){for(r=0;r<a;++r)if(d[r]===g){n=0;q=h;for(p=0;p<g;++p)n=n<<1|q&1,q>>=1;m=g<<16|r;for(p=n;p<b;p+=k)f[p]=m;++h}++g;h<<=1;k<<=1}return[f,c,e]};function ia(d,a){this.h=ma;this.w=0;this.input=F&&d instanceof Array?new Uint8Array(d):d;this.b=0;a&&(a.lazy&&(this.w=a.lazy),"number"===typeof a.compressionType&&(this.h=a.compressionType),a.outputBuffer&&(this.a=F&&a.outputBuffer instanceof Array?new Uint8Array(a.outputBuffer):a.outputBuffer),"number"===typeof a.outputIndex&&(this.b=a.outputIndex));this.a||(this.a=new (F?Uint8Array:Array)(32768))}var ma=2,na={NONE:0,r:1,k:ma,O:3},oa=[],S; | ||
| 5 | +for(S=0;288>S;S++)switch(x){case 143>=S:oa.push([S+48,8]);break;case 255>=S:oa.push([S-144+400,9]);break;case 279>=S:oa.push([S-256+0,7]);break;case 287>=S:oa.push([S-280+192,8]);break;default:l("invalid literal: "+S)} | ||
| 6 | +ia.prototype.j=function(){var d,a,c,e,b=this.input;switch(this.h){case 0:c=0;for(e=b.length;c<e;){a=F?b.subarray(c,c+65535):b.slice(c,c+65535);c+=a.length;var f=a,g=c===e,h=v,k=v,n=v,q=v,r=v,p=this.a,m=this.b;if(F){for(p=new Uint8Array(this.a.buffer);p.length<=m+f.length+5;)p=new Uint8Array(p.length<<1);p.set(this.a)}h=g?1:0;p[m++]=h|0;k=f.length;n=~k+65536&65535;p[m++]=k&255;p[m++]=k>>>8&255;p[m++]=n&255;p[m++]=n>>>8&255;if(F)p.set(f,m),m+=f.length,p=p.subarray(0,m);else{q=0;for(r=f.length;q<r;++q)p[m++]= | ||
| 7 | +f[q];p.length=m}this.b=m;this.a=p}break;case 1:var s=new H(F?new Uint8Array(this.a.buffer):this.a,this.b);s.d(1,1,x);s.d(1,2,x);var w=pa(this,b),y,ja,A;y=0;for(ja=w.length;y<ja;y++)if(A=w[y],H.prototype.d.apply(s,oa[A]),256<A)s.d(w[++y],w[++y],x),s.d(w[++y],5),s.d(w[++y],w[++y],x);else if(256===A)break;this.a=s.finish();this.b=this.a.length;break;case ma:var C=new H(F?new Uint8Array(this.a.buffer):this.a,this.b),Ea,M,U,V,W,gb=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],ba,Fa,ca,Ga,ka,ra=Array(19), | ||
| 8 | +Ha,X,la,z,Ia;Ea=ma;C.d(1,1,x);C.d(Ea,2,x);M=pa(this,b);ba=qa(this.M,15);Fa=sa(ba);ca=qa(this.L,7);Ga=sa(ca);for(U=286;257<U&&0===ba[U-1];U--);for(V=30;1<V&&0===ca[V-1];V--);var Ja=U,Ka=V,I=new (F?Uint32Array:Array)(Ja+Ka),t,J,u,da,G=new (F?Uint32Array:Array)(316),E,B,K=new (F?Uint8Array:Array)(19);for(t=J=0;t<Ja;t++)I[J++]=ba[t];for(t=0;t<Ka;t++)I[J++]=ca[t];if(!F){t=0;for(da=K.length;t<da;++t)K[t]=0}t=E=0;for(da=I.length;t<da;t+=J){for(J=1;t+J<da&&I[t+J]===I[t];++J);u=J;if(0===I[t])if(3>u)for(;0< | ||
| 9 | +u--;)G[E++]=0,K[0]++;else for(;0<u;)B=138>u?u:138,B>u-3&&B<u&&(B=u-3),10>=B?(G[E++]=17,G[E++]=B-3,K[17]++):(G[E++]=18,G[E++]=B-11,K[18]++),u-=B;else if(G[E++]=I[t],K[I[t]]++,u--,3>u)for(;0<u--;)G[E++]=I[t],K[I[t]]++;else for(;0<u;)B=6>u?u:6,B>u-3&&B<u&&(B=u-3),G[E++]=16,G[E++]=B-3,K[16]++,u-=B}d=F?G.subarray(0,E):G.slice(0,E);ka=qa(K,7);for(z=0;19>z;z++)ra[z]=ka[gb[z]];for(W=19;4<W&&0===ra[W-1];W--);Ha=sa(ka);C.d(U-257,5,x);C.d(V-1,5,x);C.d(W-4,4,x);for(z=0;z<W;z++)C.d(ra[z],3,x);z=0;for(Ia=d.length;z< | ||
| 10 | +Ia;z++)if(X=d[z],C.d(Ha[X],ka[X],x),16<=X){z++;switch(X){case 16:la=2;break;case 17:la=3;break;case 18:la=7;break;default:l("invalid code: "+X)}C.d(d[z],la,x)}var La=[Fa,ba],Ma=[Ga,ca],L,Na,ea,ua,Oa,Pa,Qa,Ra;Oa=La[0];Pa=La[1];Qa=Ma[0];Ra=Ma[1];L=0;for(Na=M.length;L<Na;++L)if(ea=M[L],C.d(Oa[ea],Pa[ea],x),256<ea)C.d(M[++L],M[++L],x),ua=M[++L],C.d(Qa[ua],Ra[ua],x),C.d(M[++L],M[++L],x);else if(256===ea)break;this.a=C.finish();this.b=this.a.length;break;default:l("invalid compression type")}return this.a}; | ||
| 11 | +function ta(d,a){this.length=d;this.H=a} | ||
| 12 | +var va=function(){function d(b){switch(x){case 3===b:return[257,b-3,0];case 4===b:return[258,b-4,0];case 5===b:return[259,b-5,0];case 6===b:return[260,b-6,0];case 7===b:return[261,b-7,0];case 8===b:return[262,b-8,0];case 9===b:return[263,b-9,0];case 10===b:return[264,b-10,0];case 12>=b:return[265,b-11,1];case 14>=b:return[266,b-13,1];case 16>=b:return[267,b-15,1];case 18>=b:return[268,b-17,1];case 22>=b:return[269,b-19,2];case 26>=b:return[270,b-23,2];case 30>=b:return[271,b-27,2];case 34>=b:return[272, | ||
| 13 | +b-31,2];case 42>=b:return[273,b-35,3];case 50>=b:return[274,b-43,3];case 58>=b:return[275,b-51,3];case 66>=b:return[276,b-59,3];case 82>=b:return[277,b-67,4];case 98>=b:return[278,b-83,4];case 114>=b:return[279,b-99,4];case 130>=b:return[280,b-115,4];case 162>=b:return[281,b-131,5];case 194>=b:return[282,b-163,5];case 226>=b:return[283,b-195,5];case 257>=b:return[284,b-227,5];case 258===b:return[285,b-258,0];default:l("invalid length: "+b)}}var a=[],c,e;for(c=3;258>=c;c++)e=d(c),a[c]=e[2]<<24|e[1]<< | ||
| 14 | +16|e[0];return a}(),wa=F?new Uint32Array(va):va; | ||
| 15 | +function pa(d,a){function c(b,c){var a=b.H,d=[],e=0,f;f=wa[b.length];d[e++]=f&65535;d[e++]=f>>16&255;d[e++]=f>>24;var g;switch(x){case 1===a:g=[0,a-1,0];break;case 2===a:g=[1,a-2,0];break;case 3===a:g=[2,a-3,0];break;case 4===a:g=[3,a-4,0];break;case 6>=a:g=[4,a-5,1];break;case 8>=a:g=[5,a-7,1];break;case 12>=a:g=[6,a-9,2];break;case 16>=a:g=[7,a-13,2];break;case 24>=a:g=[8,a-17,3];break;case 32>=a:g=[9,a-25,3];break;case 48>=a:g=[10,a-33,4];break;case 64>=a:g=[11,a-49,4];break;case 96>=a:g=[12,a- | ||
| 16 | +65,5];break;case 128>=a:g=[13,a-97,5];break;case 192>=a:g=[14,a-129,6];break;case 256>=a:g=[15,a-193,6];break;case 384>=a:g=[16,a-257,7];break;case 512>=a:g=[17,a-385,7];break;case 768>=a:g=[18,a-513,8];break;case 1024>=a:g=[19,a-769,8];break;case 1536>=a:g=[20,a-1025,9];break;case 2048>=a:g=[21,a-1537,9];break;case 3072>=a:g=[22,a-2049,10];break;case 4096>=a:g=[23,a-3073,10];break;case 6144>=a:g=[24,a-4097,11];break;case 8192>=a:g=[25,a-6145,11];break;case 12288>=a:g=[26,a-8193,12];break;case 16384>= | ||
| 17 | +a:g=[27,a-12289,12];break;case 24576>=a:g=[28,a-16385,13];break;case 32768>=a:g=[29,a-24577,13];break;default:l("invalid distance")}f=g;d[e++]=f[0];d[e++]=f[1];d[e++]=f[2];var h,k;h=0;for(k=d.length;h<k;++h)p[m++]=d[h];w[d[0]]++;y[d[3]]++;s=b.length+c-1;r=null}var e,b,f,g,h,k={},n,q,r,p=F?new Uint16Array(2*a.length):[],m=0,s=0,w=new (F?Uint32Array:Array)(286),y=new (F?Uint32Array:Array)(30),ja=d.w,A;if(!F){for(f=0;285>=f;)w[f++]=0;for(f=0;29>=f;)y[f++]=0}w[256]=1;e=0;for(b=a.length;e<b;++e){f=h=0; | ||
| 18 | +for(g=3;f<g&&e+f!==b;++f)h=h<<8|a[e+f];k[h]===v&&(k[h]=[]);n=k[h];if(!(0<s--)){for(;0<n.length&&32768<e-n[0];)n.shift();if(e+3>=b){r&&c(r,-1);f=0;for(g=b-e;f<g;++f)A=a[e+f],p[m++]=A,++w[A];break}0<n.length?(q=xa(a,e,n),r?r.length<q.length?(A=a[e-1],p[m++]=A,++w[A],c(q,0)):c(r,-1):q.length<ja?r=q:c(q,0)):r?c(r,-1):(A=a[e],p[m++]=A,++w[A])}n.push(e)}p[m++]=256;w[256]++;d.M=w;d.L=y;return F?p.subarray(0,m):p} | ||
| 19 | +function xa(d,a,c){var e,b,f=0,g,h,k,n,q=d.length;h=0;n=c.length;a:for(;h<n;h++){e=c[n-h-1];g=3;if(3<f){for(k=f;3<k;k--)if(d[e+k-1]!==d[a+k-1])continue a;g=f}for(;258>g&&a+g<q&&d[e+g]===d[a+g];)++g;g>f&&(b=e,f=g);if(258===g)break}return new ta(f,a-b)} | ||
| 20 | +function qa(d,a){var c=d.length,e=new ha(572),b=new (F?Uint8Array:Array)(c),f,g,h,k,n;if(!F)for(k=0;k<c;k++)b[k]=0;for(k=0;k<c;++k)0<d[k]&&e.push(k,d[k]);f=Array(e.length/2);g=new (F?Uint32Array:Array)(e.length/2);if(1===f.length)return b[e.pop().index]=1,b;k=0;for(n=e.length/2;k<n;++k)f[k]=e.pop(),g[k]=f[k].value;h=ya(g,g.length,a);k=0;for(n=f.length;k<n;++k)b[f[k].index]=h[k];return b} | ||
| 21 | +function ya(d,a,c){function e(b){var c=k[b][n[b]];c===a?(e(b+1),e(b+1)):--g[c];++n[b]}var b=new (F?Uint16Array:Array)(c),f=new (F?Uint8Array:Array)(c),g=new (F?Uint8Array:Array)(a),h=Array(c),k=Array(c),n=Array(c),q=(1<<c)-a,r=1<<c-1,p,m,s,w,y;b[c-1]=a;for(m=0;m<c;++m)q<r?f[m]=0:(f[m]=1,q-=r),q<<=1,b[c-2-m]=(b[c-1-m]/2|0)+a;b[0]=f[0];h[0]=Array(b[0]);k[0]=Array(b[0]);for(m=1;m<c;++m)b[m]>2*b[m-1]+f[m]&&(b[m]=2*b[m-1]+f[m]),h[m]=Array(b[m]),k[m]=Array(b[m]);for(p=0;p<a;++p)g[p]=c;for(s=0;s<b[c-1];++s)h[c- | ||
| 22 | +1][s]=d[s],k[c-1][s]=s;for(p=0;p<c;++p)n[p]=0;1===f[c-1]&&(--g[0],++n[c-1]);for(m=c-2;0<=m;--m){w=p=0;y=n[m+1];for(s=0;s<b[m];s++)w=h[m+1][y]+h[m+1][y+1],w>d[p]?(h[m][s]=w,k[m][s]=a,y+=2):(h[m][s]=d[p],k[m][s]=p,++p);n[m]=0;1===f[m]&&e(m)}return g} | ||
| 23 | +function sa(d){var a=new (F?Uint16Array:Array)(d.length),c=[],e=[],b=0,f,g,h,k;f=0;for(g=d.length;f<g;f++)c[d[f]]=(c[d[f]]|0)+1;f=1;for(g=16;f<=g;f++)e[f]=b,b+=c[f]|0,b<<=1;f=0;for(g=d.length;f<g;f++){b=e[d[f]];e[d[f]]+=1;h=a[f]=0;for(k=d[f];h<k;h++)a[f]=a[f]<<1|b&1,b>>>=1}return a};function T(d,a){this.l=[];this.m=32768;this.e=this.g=this.c=this.q=0;this.input=F?new Uint8Array(d):d;this.s=!1;this.n=za;this.C=!1;if(a||!(a={}))a.index&&(this.c=a.index),a.bufferSize&&(this.m=a.bufferSize),a.bufferType&&(this.n=a.bufferType),a.resize&&(this.C=a.resize);switch(this.n){case Aa:this.b=32768;this.a=new (F?Uint8Array:Array)(32768+this.m+258);break;case za:this.b=0;this.a=new (F?Uint8Array:Array)(this.m);this.f=this.K;this.t=this.I;this.o=this.J;break;default:l(Error("invalid inflate mode"))}} | ||
| 24 | +var Aa=0,za=1,Ba={F:Aa,D:za}; | ||
| 25 | +T.prototype.p=function(){for(;!this.s;){var d=Y(this,3);d&1&&(this.s=x);d>>>=1;switch(d){case 0:var a=this.input,c=this.c,e=this.a,b=this.b,f=a.length,g=v,h=v,k=e.length,n=v;this.e=this.g=0;c+1>=f&&l(Error("invalid uncompressed block header: LEN"));g=a[c++]|a[c++]<<8;c+1>=f&&l(Error("invalid uncompressed block header: NLEN"));h=a[c++]|a[c++]<<8;g===~h&&l(Error("invalid uncompressed block header: length verify"));c+g>a.length&&l(Error("input buffer is broken"));switch(this.n){case Aa:for(;b+g>e.length;){n= | ||
| 26 | +k-b;g-=n;if(F)e.set(a.subarray(c,c+n),b),b+=n,c+=n;else for(;n--;)e[b++]=a[c++];this.b=b;e=this.f();b=this.b}break;case za:for(;b+g>e.length;)e=this.f({v:2});break;default:l(Error("invalid inflate mode"))}if(F)e.set(a.subarray(c,c+g),b),b+=g,c+=g;else for(;g--;)e[b++]=a[c++];this.c=c;this.b=b;this.a=e;break;case 1:this.o(Ca,Da);break;case 2:Sa(this);break;default:l(Error("unknown BTYPE: "+d))}}return this.t()}; | ||
| 27 | +var Ta=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],Ua=F?new Uint16Array(Ta):Ta,Va=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],Wa=F?new Uint16Array(Va):Va,Xa=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],Ya=F?new Uint8Array(Xa):Xa,Za=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],$a=F?new Uint16Array(Za):Za,ab=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10, | ||
| 28 | +10,11,11,12,12,13,13],bb=F?new Uint8Array(ab):ab,cb=new (F?Uint8Array:Array)(288),Z,db;Z=0;for(db=cb.length;Z<db;++Z)cb[Z]=143>=Z?8:255>=Z?9:279>=Z?7:8;var Ca=R(cb),eb=new (F?Uint8Array:Array)(30),fb,hb;fb=0;for(hb=eb.length;fb<hb;++fb)eb[fb]=5;var Da=R(eb);function Y(d,a){for(var c=d.g,e=d.e,b=d.input,f=d.c,g=b.length,h;e<a;)f>=g&&l(Error("input buffer is broken")),c|=b[f++]<<e,e+=8;h=c&(1<<a)-1;d.g=c>>>a;d.e=e-a;d.c=f;return h} | ||
| 29 | +function ib(d,a){for(var c=d.g,e=d.e,b=d.input,f=d.c,g=b.length,h=a[0],k=a[1],n,q;e<k&&!(f>=g);)c|=b[f++]<<e,e+=8;n=h[c&(1<<k)-1];q=n>>>16;d.g=c>>q;d.e=e-q;d.c=f;return n&65535} | ||
| 30 | +function Sa(d){function a(a,b,c){var d,e=this.z,f,g;for(g=0;g<a;)switch(d=ib(this,b),d){case 16:for(f=3+Y(this,2);f--;)c[g++]=e;break;case 17:for(f=3+Y(this,3);f--;)c[g++]=0;e=0;break;case 18:for(f=11+Y(this,7);f--;)c[g++]=0;e=0;break;default:e=c[g++]=d}this.z=e;return c}var c=Y(d,5)+257,e=Y(d,5)+1,b=Y(d,4)+4,f=new (F?Uint8Array:Array)(Ua.length),g,h,k,n;for(n=0;n<b;++n)f[Ua[n]]=Y(d,3);if(!F){n=b;for(b=f.length;n<b;++n)f[Ua[n]]=0}g=R(f);h=new (F?Uint8Array:Array)(c);k=new (F?Uint8Array:Array)(e); | ||
| 31 | +d.z=0;d.o(R(a.call(d,c,g,h)),R(a.call(d,e,g,k)))}T.prototype.o=function(d,a){var c=this.a,e=this.b;this.u=d;for(var b=c.length-258,f,g,h,k;256!==(f=ib(this,d));)if(256>f)e>=b&&(this.b=e,c=this.f(),e=this.b),c[e++]=f;else{g=f-257;k=Wa[g];0<Ya[g]&&(k+=Y(this,Ya[g]));f=ib(this,a);h=$a[f];0<bb[f]&&(h+=Y(this,bb[f]));e>=b&&(this.b=e,c=this.f(),e=this.b);for(;k--;)c[e]=c[e++-h]}for(;8<=this.e;)this.e-=8,this.c--;this.b=e}; | ||
| 32 | +T.prototype.J=function(d,a){var c=this.a,e=this.b;this.u=d;for(var b=c.length,f,g,h,k;256!==(f=ib(this,d));)if(256>f)e>=b&&(c=this.f(),b=c.length),c[e++]=f;else{g=f-257;k=Wa[g];0<Ya[g]&&(k+=Y(this,Ya[g]));f=ib(this,a);h=$a[f];0<bb[f]&&(h+=Y(this,bb[f]));e+k>b&&(c=this.f(),b=c.length);for(;k--;)c[e]=c[e++-h]}for(;8<=this.e;)this.e-=8,this.c--;this.b=e}; | ||
| 33 | +T.prototype.f=function(){var d=new (F?Uint8Array:Array)(this.b-32768),a=this.b-32768,c,e,b=this.a;if(F)d.set(b.subarray(32768,d.length));else{c=0;for(e=d.length;c<e;++c)d[c]=b[c+32768]}this.l.push(d);this.q+=d.length;if(F)b.set(b.subarray(a,a+32768));else for(c=0;32768>c;++c)b[c]=b[a+c];this.b=32768;return b}; | ||
| 34 | +T.prototype.K=function(d){var a,c=this.input.length/this.c+1|0,e,b,f,g=this.input,h=this.a;d&&("number"===typeof d.v&&(c=d.v),"number"===typeof d.G&&(c+=d.G));2>c?(e=(g.length-this.c)/this.u[2],f=258*(e/2)|0,b=f<h.length?h.length+f:h.length<<1):b=h.length*c;F?(a=new Uint8Array(b),a.set(h)):a=h;return this.a=a}; | ||
| 35 | +T.prototype.t=function(){var d=0,a=this.a,c=this.l,e,b=new (F?Uint8Array:Array)(this.q+(this.b-32768)),f,g,h,k;if(0===c.length)return F?this.a.subarray(32768,this.b):this.a.slice(32768,this.b);f=0;for(g=c.length;f<g;++f){e=c[f];h=0;for(k=e.length;h<k;++h)b[d++]=e[h]}f=32768;for(g=this.b;f<g;++f)b[d++]=a[f];this.l=[];return this.buffer=b}; | ||
| 36 | +T.prototype.I=function(){var d,a=this.b;F?this.C?(d=new Uint8Array(a),d.set(this.a.subarray(0,a))):d=this.a.subarray(0,a):(this.a.length>a&&(this.a.length=a),d=this.a);return this.buffer=d};function jb(d){if("string"===typeof d){var a=d.split(""),c,e;c=0;for(e=a.length;c<e;c++)a[c]=(a[c].charCodeAt(0)&255)>>>0;d=a}for(var b=1,f=0,g=d.length,h,k=0;0<g;){h=1024<g?1024:g;g-=h;do b+=d[k++],f+=b;while(--h);b%=65521;f%=65521}return(f<<16|b)>>>0};function kb(d,a){var c,e;this.input=d;this.c=0;if(a||!(a={}))a.index&&(this.c=a.index),a.verify&&(this.N=a.verify);c=d[this.c++];e=d[this.c++];switch(c&15){case lb:this.method=lb;break;default:l(Error("unsupported compression method"))}0!==((c<<8)+e)%31&&l(Error("invalid fcheck flag:"+((c<<8)+e)%31));e&32&&l(Error("fdict flag is not supported"));this.B=new T(d,{index:this.c,bufferSize:a.bufferSize,bufferType:a.bufferType,resize:a.resize})} | ||
| 37 | +kb.prototype.p=function(){var d=this.input,a,c;a=this.B.p();this.c=this.B.c;this.N&&(c=(d[this.c++]<<24|d[this.c++]<<16|d[this.c++]<<8|d[this.c++])>>>0,c!==jb(a)&&l(Error("invalid adler-32 checksum")));return a};var lb=8;function mb(d,a){this.input=d;this.a=new (F?Uint8Array:Array)(32768);this.h=$.k;var c={},e;if((a||!(a={}))&&"number"===typeof a.compressionType)this.h=a.compressionType;for(e in a)c[e]=a[e];c.outputBuffer=this.a;this.A=new ia(this.input,c)}var $=na; | ||
| 38 | +mb.prototype.j=function(){var d,a,c,e,b,f,g,h=0;g=this.a;d=lb;switch(d){case lb:a=Math.LOG2E*Math.log(32768)-8;break;default:l(Error("invalid compression method"))}c=a<<4|d;g[h++]=c;switch(d){case lb:switch(this.h){case $.NONE:b=0;break;case $.r:b=1;break;case $.k:b=2;break;default:l(Error("unsupported compression type"))}break;default:l(Error("invalid compression method"))}e=b<<6|0;g[h++]=e|31-(256*c+e)%31;f=jb(this.input);this.A.b=h;g=this.A.j();h=g.length;F&&(g=new Uint8Array(g.buffer),g.length<= | ||
| 39 | +h+4&&(this.a=new Uint8Array(g.length+4),this.a.set(g),g=this.a),g=g.subarray(0,h+4));g[h++]=f>>24&255;g[h++]=f>>16&255;g[h++]=f>>8&255;g[h++]=f&255;return g};function nb(d,a){var c,e,b,f;if(Object.keys)c=Object.keys(a);else for(e in c=[],b=0,a)c[b++]=e;b=0;for(f=c.length;b<f;++b)e=c[b],D(d+"."+e,a[e])};D("Zlib.Inflate",kb);D("Zlib.Inflate.prototype.decompress",kb.prototype.p);nb("Zlib.Inflate.BufferType",{ADAPTIVE:Ba.D,BLOCK:Ba.F});D("Zlib.Deflate",mb);D("Zlib.Deflate.compress",function(d,a){return(new mb(d,a)).j()});D("Zlib.Deflate.prototype.compress",mb.prototype.j);nb("Zlib.Deflate.CompressionType",{NONE:$.NONE,FIXED:$.r,DYNAMIC:$.k});}).call(this); //@ sourceMappingURL=zlib.min.js.map |
test/README.md
0 → 100644
| 1 | +# TEST FOLDER |
test/index.js
0 → 100644
webpack.config.umd.js
0 → 100644
| 1 | +module.exports = function (umdConf) { | ||
| 2 | + umdConf.devServer.host = '0.0.0.0'; | ||
| 3 | + //umdConf.webpackFeatures.enableEntryHTML();//生成 | ||
| 4 | + umdConf.output.publicPath = ''; | ||
| 5 | + umdConf.output.library = 'MessageEngine'; | ||
| 6 | + | ||
| 7 | + //console.dir(umdConf); | ||
| 8 | + | ||
| 9 | + if (umdConf.devMode) { | ||
| 10 | + umdConf.webpackFeatures.enableEntryHot(); | ||
| 11 | + } else { | ||
| 12 | + umdConf.webpackFeatures.enableUglifyJs({ | ||
| 13 | + comments: false | ||
| 14 | + }); | ||
| 15 | + } | ||
| 16 | +}; | ||
| 17 | + |
-
请 注册 或 登录 后发表评论