Created
December 18, 2017 21:00
-
-
Save didierfranc/4ae4fb91df6dee4d9783724b7944cb5f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Legacy code | |
const messages = [] | |
const getMessages = async () => { | |
messages = await fetch('/messages').then(r => r.json()) | |
} | |
// Make it live | |
const ws = new WebSocket(`wss://socket.cool/${app}/${channel}/${uid}`) | |
ws.onmessage = getMessages |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment