Published
Edited
Oct 15, 2020
2 forks
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
session = await diffusion.connect({
host: serverURL,
principal: 'myuser',
credentials: 'hunter2'
})
Insert cell
Insert cell
{
const topicPath = 'my/topic';
await session.topicUpdate.set(
topicPath,
diffusion.datatypes.double(),
publishedValue,
{
specification: new diffusion.topics.TopicSpecification(
diffusion.topics.TopicType.DOUBLE
)
}
);
return `${topicPath} set to ${publishedValue}`;
}
Insert cell
Insert cell
Insert cell
Insert cell
{
// Prepare the internal wiring
const topicPath = "my/topic";
session
.addStream(topicPath, diffusion.datatypes.double())
.on('value', (topic, specification, newValue, oldValue) => {
mutable subscribedValue = newValue;
});

// Tell the server what we want
await session.select(topicPath);
return `Subscribed to ${topicPath}`;
}
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