blob: fb0b5622c381673445a36485f68853df38c664a0 (
plain)
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
|
//
// Connections Controller
//
'use strict';
module.exports = function() {
var app = this.app,
core = this.core,
middlewares = this.middlewares;
//
// Routes
//
app.get('/connections', middlewares.requireLogin, function(req) {
req.io.route('connections:list');
});
app.get('/connections/type/:type', middlewares.requireLogin, function(req) {
req.io.route('connections:list');
});
app.get('/connections/user/:user', middlewares.requireLogin, function(req) {
req.io.route('connections:list');
});
//
// Sockets
//
app.io.route('connections', {
list: function(req, res) {
var query = {};
if (req.param('type')) {
query.type = req.param('type');
}
if (req.param('user')) {
query.user = req.param('user');
}
var connections = core.presence.system.connections.query(query);
res.json(connections);
}
});
};
|