1 |
// Set this to something unique to this client |
2 |
|
3 |
function process(data) { |
4 |
var a = data.split('|'); |
5 |
console.info('process', a); |
6 |
$('#test').html( a[1] ); |
7 |
if ( a[0] > 0 ) { |
8 |
$('#koha') |
9 |
.html( 'Loading item '+a[0]+' from Koha' ) |
10 |
.load( '/koha/' + a[0] ) |
11 |
; |
12 |
} else if ( a[0] < 0 ) { |
13 |
$('#koha').html( '--' ); |
14 |
} |
15 |
}; |
16 |
|
17 |
$(document).ready( function() { |
18 |
|
19 |
var channel = 'test'; |
20 |
|
21 |
Meteor.hostid = '409897502705'; |
22 |
|
23 |
// Our Meteor server is on the data. subdomain |
24 |
Meteor.host = 'data.' + location.hostname; |
25 |
Meteor.port = 4670; |
26 |
|
27 |
// Call the test() function when data arrives |
28 |
Meteor.registerEventCallback("process", process ); |
29 |
|
30 |
console.info('Meteor connect', channel, Meteor.status ); |
31 |
|
32 |
// Join the demo channel and get last five events, then stream |
33 |
Meteor.joinChannel( channel, 5 ); |
34 |
Meteor.mode = 'stream'; |
35 |
|
36 |
// Start streaming! |
37 |
Meteor.connect(); |
38 |
|
39 |
|
40 |
}); |