|
|
|
|
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.DanmakuWebSocket=t():e.DanmakuWebSocket=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=1)}([function(e,t,n){"use strict";var i={WS_OP_HEARTBEAT:2,WS_OP_HEARTBEAT_REPLY:3,WS_OP_MESSAGE:5,WS_OP_USER_AUTHENTICATION:7,WS_OP_CONNECT_SUCCESS:8,WS_PACKAGE_HEADER_TOTAL_LENGTH:16,WS_PACKAGE_OFFSET:0,WS_HEADER_OFFSET:4,WS_VERSION_OFFSET:6,WS_OPERATION_OFFSET:8,WS_SEQUENCE_OFFSET:12,WS_BODY_PROTOCOL_VERSION_NORMAL:0,WS_BODY_PROTOCOL_VERSION_DEFLATE:2,WS_HEADER_DEFAULT_VERSION:1,WS_HEADER_DEFAULT_OPERATION:1,WS_HEADER_DEFAULT_SEQUENCE:1,WS_AUTH_OK:0,WS_AUTH_TOKEN_ERROR:-101};t.a=i},function(e,t,n){var i=n(2).default;e.exports=i},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var o=n(3),r=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),a=function(){function e(t){return i(this,e),"development"===e.CONFIG.bundleType&&(console.clear(),console.dir(e.CONFIG)),this.initialize(t)}return e.prototype.initialize=function(t){return"development"===e.CONFIG.bundleType&&console.log("App Initialized."),this.ws=new o.a(t),this.getReturn()},e.prototype.getReturn=function(){return"development"===e.CONFIG.bundleType?this:{destroy:this.destroy.bind(this),send:this.send.bind(this),getAuthInfo:this.getAuthInfo.bind(this),getRetryCount:this.getRetryCount.bind(this)}},e.prototype.destroy=function(){this.ws&&this.ws.destroy()},e.prototype.send=function(e){this.ws&&this.ws.send(e)},e.prototype.getAuthInfo=function(){return this.ws&&this.ws.getAuthInfo()},e.prototype.getRetryCount=function(){return this.ws&&this.ws.getRetryCount()},r(e,null,[{key:"CONFIG",get:function(){return{version:"1.4.3",gitHash:"bf68b6a8",build:"32",bundleType:"release"}}}]),e}();t.default=a},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=n(0),r=n(4),a=n(5),s=n(6).inflate,u=function(){function e(t){if(i(this,e),e.checkOptions(t)){var n={url:"",urlList:[],rid:0,aid:0,uid:0,from:-1,retry:!0,retryMaxCount:0,retryInterval:5,retryThreadCount:10,connectTimeout:5e3,retryConnectCount:3,retryconnectTimeout:1e4,retryRoundInterval:Math.floor(2*Math.random())+3,customAuthParam:[],fallback:function(){},heartBeatInterval:30,onReceivedMessage:function(){},onReceiveAuthRes:function(){},onHeartBeatReply:function(){},onInitialized:function(){},onOpen:function(){},onClose:function(){},onError:function(){},onListConnectError:function(){}};this.options=a.a.extend({},n,t),this.wsBinaryHeaderList=a.a.extend([],r.a),this.authInfo={origin:"",encode:""},0!==this.options.urlList.length&&0!==this.options.retryMaxCount&&this.options.retryMaxCount<this.options.urlList.length&&(this.options.retryMaxCount=this.options.urlList.length-1),this.state={retryCount:0,listConnectFinishedCount:0,index:0,connectTimeoutTimes:0},this.callbackQueueList={onInitializedQueue:[],onOpenQueue:[],onCloseQueue:[],onErrorQueue:[],onReceivedMessageQueue:[],onHeartBeatReplyQueue:[],onRetryFallbackQueue:[],onListConnectErrorQueue:[],onReceiveAuthResQueue:[]},this.HEART_BEAT_INTERVAL=0,this.CONNECT_TIMEOUT=0,this.mixinCallback().initialize(this.options.urlList.length>0?this.options.urlList[0]:this.options.url)}}return e.
|