Last active
May 14, 2021 17:53
-
-
Save amitrahav/18354a97349aae2a96e18ca733186bf0 to your computer and use it in GitHub Desktop.
SocketVsSSE
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
// addEventListener version | |
evtSource.addEventListener("open", (e) => { | |
console.log("The connection has been established."); | |
}); | |
// onopen version | |
evtSource.onopen = (e) => { | |
console.log("The connection has been established."); | |
}; | |
// Connection opened | |
socket.addEventListener("open", (event) => { | |
socket.send("Hello Server!""); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment