Skip to content
ShipFastDev
All posts

Article

Live data on a 3D globe with CesiumJS: aircraft, ships and satellites without freezing the browser

, 8 min read

To show live aircraft, ships and satellites on a CesiumJS globe without freezing the visitor's machine, keep the browser's job small. The server filters each feed down to what the viewer can see and sends compact binary updates; the GPU moves objects between updates; Web Workers do the decoding and orbit maths; and the page renders less whenever nobody is interacting or the tab is hidden. This is how SkyEye, ShipFastDev's in-house 3D globe, is built, and the numbers below are measurements taken from its own commit history, not general benchmarks.

What SkyEye shows, and why it is hard

SkyEye is a CesiumJS globe you can fly around freely, with layers for aircraft, roughly 16,000 satellites, ships, public transport, traffic cameras, disaster alerts and more. It also includes JARVIS, an assistant that queries the live data and drives the camera (the AI side is a topic of its own, covered in adding AI features to your product).

The difficulty is volume: tens of thousands of objects move every second, feeds update at different rates, and the globe's terrain and imagery already load the GPU. Each technique below removes one source of load.

Step 1: choose the feeds and respect their rules

Each provider's limits shape the architecture more than any rendering choice.

  • Aircraft (OpenSky Network). The OpenSky REST API now uses the OAuth2 client credentials flow: "Basic authentication with username and password is no longer accepted", and access tokens expire after 30 minutes. Anonymous users get 400 API credits a day and 10-second time resolution; a standard registered user gets 4,000 credits a day and 5-second resolution. A /states/all query costs 1 to 4 credits depending on the bounding-box area, and when credits run out the API returns 429 with an X-Rate-Limit-Retry-After-Seconds header. SkyEye polls in a credit-aware way: with OAuth credentials it refreshes global aircraft every 90 seconds, without them every 15 minutes, and community ADS-B feeds (adsb.lol) fill in between.
  • Satellites (CelesTrak). CelesTrak publishes GP element sets meant for the SGP4 propagator, in TLE and OMM formats (XML, KVN, JSON, CSV). It warns that the TLE format cannot represent catalogue numbers beyond 69,999 and recommends OMM. It also says it "only checks for new GP data once every 2 hours, so there is no need for you to check more often". Positions are then computed locally with satellite.js, which provides SGP4/SDP4 in JavaScript.
  • Ships (aisstream.io). aisstream.io is a WebSocket stream: you must send a subscription with your API key and bounding boxes within 3 seconds of connecting. Its documentation is explicit that "Direct browser connections are not permitted", so the key stays on your server and you forward only what clients need. It also drops messages if you do not consume them quickly enough, and offers no SLA.

The practical consequence: the browser never talks to the feeds directly. A small Node server (Hono with WebSockets in SkyEye's case) ingests every feed, holds the current state, and serves clients.

Step 2: filter on the server and send binary deltas

SkyEye keeps one WebSocket per client. For each layer the server keeps a grid spatial index, works out which objects fall inside that client's viewport, and sends only what changed since the last frame, as columnar binary deltas of about 33 bytes per object. When a view holds more objects than the budget (60,000 per layer by default), the server thins them in a stable way, so the same objects stay visible from one frame to the next instead of flickering.

To keep it testable, a ?synthetic=50000 URL flag spawns 50,000 fake moving objects, and performance guard tests run at 50,000 objects, so a regression fails the suite rather than a visitor's laptop.

Step 3: let the GPU move objects between updates

Feeds update every few seconds, but the screen redraws many times a second; recomputing every position on the CPU each frame scales with the object count. SkyEye draws each layer in a single draw call and extrapolates positions on the GPU (great-circle motion, relative-to-eye precision), so per-frame CPU cost stays flat whatever the count. A CPU copy of the same maths handles picking, labels and the selected object.

This matches CesiumJS's own guidance for its PointPrimitiveCollection: "prefer a few collections, each with many points, to many collections with only a few points each", and accumulate changes before an update, because rewriting the vertex buffer is an O(n) operation.

Two lessons from the history:

  • Blend, don't snap. When a new position arrives, it is blended in from the extrapolated position over a few seconds, on the GPU and in the CPU copy alike.
  • Use the wall clock and check it. An early timebase built on performance.now drifted and made fixes look future-dated, which froze and then snapped objects. Later, the development machine's clock ran 21 seconds behind real time, so every feed's positions looked about 20 seconds in the future and nothing could be extrapolated. The fix was to correct the server's time against outside sources and have the browser use that corrected time.

Detailed 3D models near the camera follow the same rule. Each aircraft model was baked to one material and one texture atlas, which took it from up to 77 draw calls to one.

Step 4: move heavy work off the main thread

Web Workers "run scripts in background threads" without interfering with the user interface, and ArrayBuffers can be transferred to and from them with a zero-copy operation. SkyEye uses them in three places:

  • Stream decoding. Decoding frames and per-object coordinate maths moved to a worker; the main thread copies ready rows in small time slices before each frame. The worst main-thread stall when zooming into 33,000 ships went from 58.6 ms to about 8 ms (measured headless).
  • Satellites. Instead of streaming 16,613 satellite positions, the server sends the whole catalogue's elements once (713 KB gzipped, with an ETag), and a worker runs SGP4 on a tenth of the catalogue each second. Socket traffic for satellites fell from 69 to 8 KB/s. If the worker fails, the client falls back to streaming.
  • Picking. Outside the workers, the same idea: prefiltering by distance to the pointer ray took a globe pick from 21 ms to 1.1 ms.

Step 5: render less when nobody is watching

A globe that redraws at 60 frames per second all the time drains batteries. Cesium's article on explicit rendering showed idle CPU use falling from 25.1% to 3.0% with requestRenderMode, but it also warns that scenes driven by simulation time need care, and a live-traffic globe is always moving. SkyEye uses a frame-rate governor instead: 60 fps only while the user interacts, during a camera flight, while following an object, on a tour or in replay; otherwise 30 fps up close, 24 at regional scale and 15 from orbit. Quality presets set frame caps, anti-aliasing and resolution, which drops to 75% while the camera moves if frames run long.

Hidden tabs need their own rule. The Page Visibility API tells you when the page is hidden, and most browsers stop requestAnimationFrame callbacks in background tabs. But MDN also notes that tabs with real-time connections such as WebSockets are exempt from timer throttling, so the data keeps flowing unless you stop it. SkyEye sends a pause message: the server stops sending frames, and on return the client catches up with one net delta, keeping moving layers hidden until it lands so objects don't jump.

Step 6: cache the heavy static files

CesiumJS dominates the bundle (about 5.3 MB in SkyEye, where all the app's own cards add up to roughly 25 KB, so splitting app code was measured and skipped). A service worker caches Cesium's files and hashed bundles cache-first, in a cache named after the Cesium version and build so an upgrade replaces it cleanly. Imagery and terrain tiles are served from cache at once and revalidated in the background after their own max-age, capped at 4,000 tiles. A production repeat visit went from about 1,400 revalidation requests to about 13. For the metrics Google uses on ordinary sites, see Core Web Vitals for founders.

Step 7: measure, then change one thing

Every number in this article came from a before-and-after measurement recorded in a commit. A few more from the same history:

  • Binary replay frames (delta-coded positions) are 40–45% smaller gzipped than the JSON they replaced, with no JSON parsing.
  • Simplifying airspace polygons cut that cache from 260 MB to 15 MB and server memory from 2 GB to 0.4 GB.

Checklist for a live-data globe

  • Keep feed keys on the server; proxy only what clients need.
  • Read each provider's limits (credits, subscription timeouts, refresh intervals) before designing polling.
  • Filter by viewport on the server and send binary deltas, with a per-layer budget and stable thinning.
  • Few draw calls, motion extrapolated on the GPU, new positions blended in.
  • Decoding and orbit propagation in Web Workers.
  • Frame-rate caps when idle; pause the stream when the tab is hidden.
  • Version-named service-worker cache for the engine and tiles.
  • Synthetic load and performance tests in the suite.

Frequently asked questions

How many objects can a CesiumJS globe display?

It depends on how you draw them. SkyEye streams up to 60,000 objects per layer by default and is load-tested with 50,000 synthetic objects, using one draw call per layer. Cesium's docs recommend a few large point collections rather than many small ones.

Can I connect to aisstream.io directly from the browser?

No. Its documentation states that direct browser connections are not permitted; keep the API key on your server and forward only the data clients need.

How often should I download satellite data from CelesTrak?

No more than every two hours: CelesTrak itself checks for new GP data once every 2 hours. Download, keep a local copy, and propagate positions with SGP4 in between.

Do I need an OpenSky account for live aircraft?

Not strictly, but anonymous access gives 400 credits a day and 10-second resolution, against 4,000 credits and 5-second resolution for a standard account, which authenticates with OAuth2 client credentials.

Sources

  1. OpenSky REST API, OpenSky Network, 2026-10
  2. A New Way to Obtain GP Data (GP data formats), CelesTrak, 2026-06
  3. AIS Stream documentation, aisstream.io, 2026-10
  4. satellite.js, GitHub (shashwatak/satellite-js), 2026-10
  5. PointPrimitiveCollection (CesiumJS 1.146 reference), Cesium, 2026-10
  6. Improving Performance with Explicit Rendering, Cesium, 2018-01
  7. Using Web Workers, MDN Web Docs, 2026-08
  8. Page Visibility API, MDN Web Docs, 2025-12

Want this kind of work on your product?

Tell Adil what you’re building. You get a reply within 1 business day with times for a 15-minute video call.