nitrogen
Version:
Nitrogen is a platform for building connected devices. Nitrogen provides the authentication, authorization, and real time message passing framework so that you can focus on your device and application. All with a consistent development platform that lev
28 lines (22 loc) • 789 B
JavaScript
var assert = require('assert')
, config = require('../config')
, fixtures = require('../fixtures')
, nitrogen = require('../../lib');
describe('heartbeat', function() {
it('should be able to send a heartbeat', function(done) {
var service = new nitrogen.Service(config);
service.connect(fixtures.models.camera, function(err, session, principal) {
assert(!err);
session.onMessage({ type: 'heartbeat' }, function(message) {
if (message.from === session.principal.id) {
done();
}
});
setTimeout(function() {
session.sendHeartbeat(function(err) {
assert(!err);
});
}, 200);
});
});
});