@tmlmobilidade/controllers 20260204.911.28 → 20260204.1159.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/rides/rides.js +4 -6
- package/package.json +1 -1
package/dist/rides/rides.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* * */
|
|
2
|
+
import { ridesChangeStream } from './watch.js';
|
|
2
3
|
import { HttpStatus } from '@tmlmobilidade/consts';
|
|
3
4
|
import { rides, ridesBatchAggregationPipeline } from '@tmlmobilidade/interfaces';
|
|
4
5
|
import { normalizeRide } from '@tmlmobilidade/normalizers';
|
|
5
6
|
import { GetRidesBatchQuerySchema, PermissionCatalog } from '@tmlmobilidade/types';
|
|
6
|
-
import { ridesChangeStream } from './watch.js';
|
|
7
7
|
/* * */
|
|
8
8
|
export class RidesSharedController {
|
|
9
9
|
//
|
|
@@ -115,16 +115,14 @@ export class RidesSharedController {
|
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
//
|
|
118
|
-
// Subscribe to the singleton change stream
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
};
|
|
118
|
+
// Subscribe to the singleton change stream immediately.
|
|
119
|
+
// Sockets do not emit 'open' or 'connection' events server-side.
|
|
120
|
+
ridesChangeStream.subscribe(listener);
|
|
122
121
|
//
|
|
123
122
|
// Cleanup the subscription to the singleton change stream
|
|
124
123
|
const cleanup = () => {
|
|
125
124
|
ridesChangeStream.unsubscribe(listener);
|
|
126
125
|
};
|
|
127
|
-
socket.on('open', subscribe);
|
|
128
126
|
socket.on('close', cleanup);
|
|
129
127
|
socket.on('error', cleanup);
|
|
130
128
|
return cleanup;
|