Public
Edited
Nov 14, 2023
Insert cell
Insert cell
Insert cell
Peer = (await import("https://esm.sh/peerjs@1.5.1")).Peer
Insert cell
msg=[]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
p1.on("connection", function (conn_1_2) {
conn_1_2.on("data", function (data) {
// Will print 'hi!'
console.log(data);
msg.push(data);
});
})
Insert cell
conn_1_2.on("open", function () {
// here you have conn.id
conn_1_2.send(`hi! at ${Date()}`);
})
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