-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgesRead.js
38 lines (31 loc) · 1.14 KB
/
gesRead.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
gesClient = require('ges-client');
var connection = gesClient({ host: '192.168.99.100' }),
stream = 'candidates';
connection.on('connect', function() {
// Read a set of events
// connection.readStreamEventsForward(stream, { start: 0, count: 1 }, function(err, readResult) {
// if (err) {
// return console.log('Ooops!', err); // connection error or stream does not exist
// }
// console.log(readResult.Events[0]);
//
// console.log("---------------- Writing data -------------");
// console.log(readResult.Events[0].OriginalEvent.Data);
// });
connection.readAllEventsForward({ maxCount: 10, position: { commitPosition: 0, preparePosition: 0 } }, function(err, readResult) {
if (err) {
return console.log('Boy oh boy wowee!', err);
}
console.log(readResult.Events[0].);
});
// Method to subscribe to stream for new events
// var subscription = connection.subscribeToStream(stream);
//
// subscription.on('event', function(event){
// console.log(event);
// });
// var subscription = connection.subscribeToStreamFrom(stream);
// subscription.on('event', function(event) {
// console.log(event);
// });
});