1
0
mirror of https://github.com/yldio/copilot.git synced 2024-12-12 21:10:05 +02:00
copilot/spikes/graphs-fe/nvd3/server/routes/metrics.js

19 lines
423 B
JavaScript
Raw Normal View History

2016-11-08 17:31:43 +02:00
const Metric = require('../metric');
module.exports = (server) => {
const metric = Metric(server);
server.subscription('/stats/{id}', {
onSubscribe: (socket, path, params, next) => {
console.log('onSubscribe');
metric.on(params.id);
next();
},
onUnsubscribe: (socket, path, params, next) => {
console.log('onUnsubscribe');
metric.off(params.id);
next();
}
});
};