Last active
November 7, 2020 14:16
-
-
Save iamparnab/e2414660dc4b136eba06b2a3cbe9e025 to your computer and use it in GitHub Desktop.
Listen to custom events in SSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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