-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest.js
85 lines (60 loc) · 1.55 KB
/
test.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
var ACSP = require('./index');
var debug = require('debug')('test');
var a = ACSP({host: '127.0.0.1', port: 11000});
var listeners = 0;
a.on('newListener', function(){
listeners++;
debug('added a listener, now have %s listeners', listeners);
})
a.on('removeListener', function(){
listeners--;
debug('removed a listener, now have %s listeners', listeners);
})
console.log('starting test!');
a.on('car_info', function(carinfo){
debug('CARINFO', carinfo);
});
a.on('new_session', function(sessioninfo){
debug('SESSIONINFO', sessioninfo);
});
a.on('car_update', function(carupdate){
debug('CARUPDATE', carupdate);
});
// for (var i = 0; i < 10; i++) {
// //a.getCarInfo(i);
// a.sendChat(i,'You are car '+i);
// }
//a.sendChat(1,'Hi');
a.enableRealtimeReport(0);
// a.getCarInfo(0).then(function(info){
// debug('Got info for car 0:', info)
// })
a.on('lap_completed',function(lapinfo){
debug('lapinfo',lapinfo);
});
//a.on('client_event',function(client_event_info){
// debug('CEI',client_event_info);
//});
a.on('connection_closed',function(cc){
debug('CC',cc);
});
a.on('new_connection',function(cc){
debug('CC',cc);
});
a.on('collide_env',function(client_event_info){
debug('COL_ENV',client_event_info);
})
a.on('collide_car',function(client_event_info){
debug('COL_CAR',client_event_info);
})
a.on('end_session',function(data){
debug('end_session', data);
});
a.on('session_info',function(data){
debug('session_info',data);
});
a.getSessionInfo(0);
a.getSessionInfo(1);
a.getSessionInfo(2);
a.getCarInfo(0);
a.broadcastChat('Hello World!');