forked from crossbario/autobahn-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.js
58 lines (42 loc) · 1.35 KB
/
configure.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
///////////////////////////////////////////////////////////////////////////////
//
// AutobahnJS - http://autobahn.ws, http://wamp.ws
//
// A JavaScript library for WAMP ("The Web Application Messaging Protocol").
//
// Copyright (C) 2011-2014 Tavendo GmbH, http://tavendo.com
//
// Licensed under the MIT License.
// http://www.opensource.org/licenses/mit-license.php
//
///////////////////////////////////////////////////////////////////////////////
function Transports() {
this._repository = {};
}
Transports.prototype.register = function (name, factory) {
this._repository[name] = factory;
};
Transports.prototype.isRegistered = function (name) {
return this._repository[name] ? true : false;
};
Transports.prototype.get = function (name) {
if (this._repository[name] !== undefined) {
return this._repository[name];
} else {
throw "no such transport: " + name;
}
}
Transports.prototype.list = function() {
var items = [];
for (var name in this._repository) {
items.push(name);
}
return items;
};
var _transports = new Transports();
// register default transports
var websocket = require('./transport/websocket.js');
_transports.register("websocket", websocket.Factory);
var longpoll = require('./transport/longpoll.js');
_transports.register("longpoll", longpoll.Factory);
exports.transports = _transports;