ASP.NET Core

.NET 11 fleet simulator with Worker Service, SignalR and Blazor

DEV Community: #blazor Rui Aparecido de Moraes
ASP.NET Core

A developer built TrackerSimulator, a .NET 11 solution where a Worker Service simulates GPS devices, a minimal API ingests the telemetry and SignalR pushes live positions into a Blazor and Leaflet dashboard, so tracking systems can be exercised without hardware.

Key points

  • Shared immutable `TrackerTelemetry` record keeps Worker and API on one contract, so payload types are not duplicated.
  • Each device holds its own state, letting `NextTelemetry` move along a heading instead of jumping to random points.
  • `SemaphoreSlim` caps concurrent HTTP posts while per-device loops add jitter to spread the load.
  • A Minimal API endpoint upserts telemetry into an in-memory store and broadcasts every update through SignalR.
  • `ConcurrentDictionary` plus `System.Threading.Lock` keep a 40-point trail per device safe under parallel writes.
  • xUnit tests cover odometer growth, the DryRun publisher mode and the maximum trail length.

Why it matters

The valuable part here is less the map than the simulation harness: once ingestion and real-time fan-out can be exercised without hardware, throughput problems and race conditions surface before a pilot does. Teams building SignalR dashboards or IoT ingestion will recognise the shape, because it deliberately stays in-memory and leaves persistence, backpressure and authentication to the reader. Treat it as a starting blueprint rather than a production system: a single Web instance shares neither store nor SignalR backplane across nodes, and one HTTP post per device will not carry a fleet in the thousands without batching or a queue.

Real-world use

  • A GPS or IoT tracking backend that must prove it handles continuous ingestion and many concurrent devices before any hardware is available.
  • A live map dashboard where clients only need the newest position plus a short recent trail instead of the full history.
  • Local development with `DryRun` enabled so the simulator runs against logs before it is pointed at the real API.

This summary was generated by the agent from the original post on DEV Community: #blazor. The full text and all rights belong to its author and publisher. Go to original

Report this story

Is something wrong with the summary, or do you own this content? Your message comes straight to my inbox.

Type of message

Related stories

Feedback

Found a bug or have an idea? Your message lands straight in my inbox.

Type of message