Compare View
Commits (2)
Changes
Showing 3 changed files Side-by-side Diff
gateway/heartbeat.js
... | ... | @@ -0,0 +1,28 @@ |
1 | +"use strict"; | |
2 | + | |
3 | +const request = require('request'); | |
4 | + | |
5 | +const config = require('../config'); | |
6 | +const logger = require('../logger'); | |
7 | +const matrix = require('../matrix'); | |
8 | + | |
9 | +function sendHeartbeat() { | |
10 | + if (!config || !config.core_url) { return; } | |
11 | + | |
12 | + const requestOptions = { | |
13 | + url: config.core_url + '/heartbeat/gateway' | |
14 | + form: { | |
15 | + name: config.handler_name, | |
16 | + config: JSON.stringify(config), | |
17 | + matrix: JSON.stringify(matrix) | |
18 | + } | |
19 | + } | |
20 | + | |
21 | + request.post(requestOptions); | |
22 | +} | |
23 | + | |
24 | +sendHeartbeat(); | |
25 | +setInterval( | |
26 | + sendHeartbeat, | |
27 | + 60 * 1000 | |
28 | +) |
gateway/pull.js