Skip to content

Instantly share code, notes, and snippets.

@iamparnab
Last active November 7, 2020 14:16
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 iamparnab/e2414660dc4b136eba06b2a3cbe9e025 to your computer and use it in GitHub Desktop.
Save iamparnab/e2414660dc4b136eba06b2a3cbe9e025 to your computer and use it in GitHub Desktop.
Listen to custom events in SSE
const ev = new EventSource("url goes here");
ev.addEventListener('sampleEvent', message => {
console.log(message.data); // the response will be available under data field
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment