Published
Edited
Jan 10, 2022
1 fork
Importers
3 stars
Insert cell
Insert cell
Insert cell
function connect(url, options = {}) {
const { compressed } = options;
const conn = new WebSocket(url);
const recv = Generators.observe(notify => {
conn.onmessage = function(event) {
try {
const data = parseString(event.data, compressed);
notify({ status: "success", data });
} catch (e) {
notify({ status: "error", err: e.message, data: event.data });
}
};
conn.onclose = function() {
notify(null);
};
notify(null);
});
return { conn, recv };
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more