Public
Edited
May 31, 2023
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
socket = {
const socket = new WebSocket("wss://atlas-stream.ripe.net/stream/");

socket.onmessage = function (event) {
const r = JSON.parse(event.data)[1];
// mutable results = results.push(r);
// console.log(r);
const rtts = r.result ? r.result.map((r) => r.rtt).filter((r) => r) : [];
// if (typeof resultsMap[r.prb_id] === "undefined")
// resultsMap[r.prb_id] = d3.min(rtts);
// else if (typeof resultsMap[r.prb_id] === "object")
// resultsMap[r.prb_id] = d3.min(resultsMap[r.prb_id], ...rtts);

// try updating the viz directly?
const rtt = d3.min(rtts);
if (rtt < 10.0 && Math.random() < chances.get(r.probe.country_code)) {
// console.log(
// chances.get(r.probe?.country_code, 0.0),
// r.probe?.country_code
// );

world.ringsData(
world
.ringsData()
.concat([
{
lat: coordinates.get(r.prb_id)?.lat,
lng: coordinates.get(r.prb_id)?.lon,
maxR: 3, //1 / rtt, //rtt, // / 10 + 3,
propagationSpeed: 1,
repeatPeriod: 0
}
])
.slice(-1000)
);
}
};
socket.onopen = function (event) {
this.send(JSON.stringify(["atlas_subscribe", params]));
};

return socket;
}
Insert cell
{
socket.send(JSON.stringify(["atlas_unsubscribe", params]));
return socket;
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more