File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,19 @@ const router = Router();
88// would easily exceed 100 MB of JSON per 5-second poll.
99const SNAPSHOT_VESSEL_LIMIT = 30_000 ;
1010
11+ router . get ( '/status' , ( req , res ) => {
12+ res . json ( {
13+ isConnected : aisStreamService . isConnected ,
14+ readyState : aisStreamService . readyState ,
15+ vesselCount : aisStreamService . vessels . size ,
16+ totalMessagesReceived : aisStreamService . totalMessagesReceived ,
17+ lastMessageReceived : aisStreamService . lastMessageReceived ,
18+ secondsSinceLastMessage : aisStreamService . lastMessageReceived
19+ ? Math . floor ( ( Date . now ( ) - aisStreamService . lastMessageReceived ) / 1000 )
20+ : null ,
21+ } ) ;
22+ } ) ;
23+
1124router . get ( '/snapshot' , ( req , res ) => {
1225 const allVessels = aisStreamService . vessels ;
1326 let vessels = Array . from ( allVessels . values ( ) ) ;
You can’t perform that action at this time.
0 commit comments