forked from balderdashy/sails-hook-sockets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (29 loc) · 833 Bytes
/
index.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
/**
* `sockets` hook
*/
module.exports = function (app){
return {
defaults: require('./lib/defaults'),
configure: require('./lib/configure')(app),
initialize: require('./lib/initialize')(app),
routes: {
// Before the app's routes...
before: {
},
// After the app's routes (i.e. if none matched)...
after: {
// This "shadow" route can be disabled by setting:
// `sails.config.sockets.grant3rdPartyCookie: false`
'GET /__getcookie': function (req, res, next) {
if (!app.config.sockets.grant3rdPartyCookie) {
return next();
}
res.send('_sailsIoJSConnect();');
}
}
},
// Default no-op admin bus
broadcastAdminMessage: function() {},
blastAdminMessage: function() {}
};
};