- Docs
- Specs
- Live ops
- Realtime channels
Realtime Channels¶
This page defines the Slice 5 Reverb channels, authorization callbacks, and location event contract.
1. Transport and channel names¶
TyteRide uses Laravel Reverb for live updates. Existing notification channels are unchanged.
| Wire channel | Authorized subscribers | Slice 5 events |
|---|---|---|
private-company.{companyId} |
Active Manager of that Company in a non-suspended Company | trip.location_updated |
private-trip.{tripId} |
Active Manager of the Trip's Company, assigned active Driver, or active Passenger with an approved Booking on the Trip | trip.location_updated |
private-trip.{tripId} replaces the earlier logical trip.{tripId} name. Laravel private channels require the private- prefix for /broadcasting/auth callbacks to run. Company channels remain Manager-only; an assigned Driver does not gain Company-channel access.
2. Authorization¶
Channel callbacks run for every subscription request and re-read current state:
- Company-channel authorization requires a Membership with
role=manager,status=active, and the requestedcompany_id; the Company must not be suspended. - Trip-channel authorization first resolves the Trip and its Company. A missing Trip or suspended Company is denied.
- The subscriber must have an active Membership in the Trip's Company and be one of:
- a Manager;
- the Driver whose Membership ID equals
trips.driver_id; - a Passenger with an
approvedBooking for that Trip and Passenger User. - A cancelled/rejected/pending Booking, suspended Membership, changed Driver assignment, or cross-Company relationship denies access.
- Denied, expired, or revoked subscriptions receive the normal private-channel authorization denial and must not be retried as authorized.
The REST endpoints in Live Tracking are the recovery source after reconnect.
3. Location event¶
Trigger: an assigned Driver successfully posts a newer location while the Trip is in_transit.
Event class: App\Infrastructure\Broadcasting\Events\TripLocationUpdated.
Event name: trip.location_updated.
Payload:
{
"event": "trip.location_updated",
"trip_id": 12,
"company_id": 1,
"status": "in_transit",
"location": {
"lat": 15.3694,
"lng": 44.1910,
"heading": 90,
"speed": 32.5,
"recorded_at": "2026-11-27T12:00:00Z"
}
}
The same payload is delivered to private-company.{companyId} and private-trip.{tripId}. It contains no phone, email, name, license, Booking, or other Passenger data. Older/equal recorded_at points are retained in history but do not emit this event.
4. Delivery and reconciliation¶
- Events are dispatched after the location transaction commits.
- Slice 5 provides no replay, ordering guarantee across reconnects, or backfill.
recorded_atlets clients ignore an older local marker. - Clients recover current state with
GET /api/passenger/trips/{id}/tracking,GET /api/company/trips/{id}/tracking, orGET /api/company/live. - ETA is target-specific and is not included in the shared event; clients use the appropriate REST resource.
- Trip status, boarding, extra-car assignment, and Driver feedback event schemas remain owned by their respective future slices.
5. Sequence¶
sequenceDiagram
autonumber
participant D as Driver App
participant A as API
participant DB as Database
participant R as Reverb
participant P as Passenger App
participant M as Fleet Dashboard
D->>A: POST /api/driver/trips/{id}/location
A->>A: Authorize Company, assignment, active Membership, in_transit
A->>DB: Store history and newest latest row
DB-->>A: Commit
A->>R: trip.location_updated on both private channels
R->>P: private-trip.{tripId}
R->>M: private-company.{companyId}
P->>A: GET tracking for ETA/recovery
M->>A: GET Company live for ETA/recovery