Skip to content

Commit

Permalink
Updated readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
RuneRogue authored Oct 2, 2024
1 parent eecc678 commit ca833cb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion docs/reference/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,21 @@ var txHandler = function (txResponse) {
console.log(txResponse);
};

var errorHandler = function (error) {
console.error("Stream encountered an error:", error);

setTimeout(() => {
console.log("Reconnecting...");
es();
}, 5000);
};

var es = server.transactions()
.forAccount(accountAddress)
.cursor(lastCursor)
.stream({
onmessage: txHandler
onmessage: txHandler,
onerror: errorHandler
})
```

Expand Down

0 comments on commit ca833cb

Please sign in to comment.