Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streaming API error handling/reporting improvements #5141

Merged
merged 7 commits into from
Mar 24, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updating command formatting in the JavaScript example.
  • Loading branch information
leo-da committed Mar 24, 2020
commit 50f66c76e24700666f441ee9f3f1d09467881486
8 changes: 4 additions & 4 deletions docs/source/json-api/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1063,16 +1063,16 @@ JavaScript/Node.js example demonstrating how to establish Streaming API connecti

console.log("Starting")

const tokenPrefix = "jwt.token."
const wsProtocol = "daml.ws.auth"
const tokenPrefix = "jwt.token."
const jwt =
"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwczovL2RhbWwuY29tL2xlZGdlci1hcGkiOnsibGVkZ2VySWQiOiJNeUxlZGdlciIsImFwcGxpY2F0aW9uSWQiOiJmb29iYXIiLCJhY3RBcyI6WyJBbGljZSJdfX0.VdDI96mw5hrfM5ZNxLyetSVwcD7XtLT4dIdHIOa9lcU"
const subprotocol = `${tokenPrefix}${jwt},${wsProtocol}`
const subprotocols = [`${tokenPrefix}${jwt}`, wsProtocol]

const ws = new WebSocket("ws://localhost:7575/v1/stream/query", [subprotocol])
const ws = new WebSocket("ws://localhost:7575/v1/stream/query", subprotocols)

ws.on("open", function open() {
ws.send(`{"templateIds": ["Iou:Iou"]}`)
ws.send(JSON.stringify({templateIds: ["Iou:Iou"]}))
})

ws.on("message", function incoming(data) {
Expand Down