Public
Edited
Jul 4, 2020
Insert cell
Insert cell
Insert cell
Insert cell
window.clients = []
Insert cell
window.websocket = new WebSocket('wss://california.demo.blackpagedigital.com:8087/')
Insert cell
window.websocket.onmessage = (message) => {
var command = JSON.parse(message.data)
console.log(command)
switch (command.verb) {
case 'new client':
window.clients[window.clients.length + 1] = command.id
window.websocket.send(JSON.stringify({
verb: 'forward',
connectionID: command.id,
message: {
verb: 'status',
status: 'Welcome to the proxied server!'}}))
break
case 'answer':
window.answer = command.answer
break
default: }}
Insert cell
window.websocket.send(
JSON.stringify({
verb: 'authenticate',
credential: '369c86f0-91b2-45cd-9dd9-b3ba4f20b216',
url: 'wss://california.demo.blackpagedigital.com:8087/observable'}))
Insert cell
Insert cell
framework = new Promise((resolve, reject) => {
var script = document.createElement('script')
script.setAttribute("type", "text/javascript")
script.setAttribute("src", "https://california.demo.blackpagedigital.com/caffeine/protobuf/protobuf.js")
script.onload = (event) => {resolve(window.protobuf)}
document.getElementsByTagName("head")[0].appendChild(script)})
Insert cell
Insert cell
import {source} from "@ccrraaiigg/protocol-buffers"
Insert cell
source
Insert cell
Insert cell
root = new Promise((resolve, reject) => {
framework.load(
source,
function (err, root) {resolve(root)})})
Insert cell
Insert cell
type = root.lookupType('jspb.test.UnnestedData')
Insert cell
payload = ({str: 'hello'})
Insert cell
// Answer an error message if verification fails, or null if it succeeds.
type.verify(payload)
Insert cell
Insert cell
message = type.create(payload)
Insert cell
buffer = type.encode(message).finish()
Insert cell
Insert cell
window.websocket.send(JSON.stringify({
verb: 'forward',
connectionID: 3,
message: {
verb: 'validate',
definition: source,
type: 'jspb.test.UnnestedData',
bytes: buffer}}))
Insert cell
Insert cell
window.answer
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