Skip to content

Instantly share code, notes, and snippets.

@neopunisher
Created May 25, 2021 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neopunisher/396a04b116d862f3452b8088ec55e93c to your computer and use it in GitHub Desktop.
Save neopunisher/396a04b116d862f3452b8088ec55e93c to your computer and use it in GitHub Desktop.
var EventSource = require("eventsource");
var es = new EventSource(
"https://horizon-testnet.stellar.org/accounts/GB7JFK56QXQ4DVJRNPDBXABNG3IVKIXWWJJRJICHRU22Z5R5PI65GAK3/payments",
);
es.onmessage = function (message) {
var result = message.data ? JSON.parse(message.data) : message;
console.log("New payment:");
console.log(result);
};
es.onerror = function (error) {
console.log("An error occurred!");
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment