INNER CODE UNIT · JavaScript
onData
ob-f/OpenBot · controller/web-server/client/index.js:25
const onData = data => {
const msg = JSON.parse(data)
const status = msg.status ?? msg
botMessageHandler.handle(status)
}
const onQuit = () => {
connection.stop()
}
// roomId must match robot app Google account or the server will not relay.
const sendToBot = (key) => {
if (!signedInUser?.email) {
console.error('Cannot send command: sign in with Google first (same account as robot app).')
return
}
const msg = JSON.parse(key)
const payload =