Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / ws / lib / browser.js
1
2 /**
3  * Module dependencies.
4  */
5
6 var global = (function() { return this; })();
7
8 /**
9  * WebSocket constructor.
10  */
11
12 var WebSocket = global.WebSocket || global.MozWebSocket;
13
14 /**
15  * Module exports.
16  */
17
18 module.exports = WebSocket ? ws : null;
19
20 /**
21  * WebSocket constructor.
22  *
23  * The third `opts` options object gets ignored in web browsers, since it's
24  * non-standard, and throws a TypeError if passed to the constructor.
25  * See: https://github.com/einaros/ws/issues/227
26  *
27  * @param {String} uri
28  * @param {Array} protocols (optional)
29  * @param {Object) opts (optional)
30  * @api public
31  */
32
33 function ws(uri, protocols, opts) {
34   var instance;
35   if (protocols) {
36     instance = new WebSocket(uri, protocols);
37   } else {
38     instance = new WebSocket(uri);
39   }
40   return instance;
41 }
42
43 if (WebSocket) ws.prototype = WebSocket.prototype;