Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created July 5, 2018 02:53
Embed
What would you like to do?
const channel = new MessageChannel();
channel.port1.onmessage = e => {
return e.data.error ?
console.log(e.data.error) :
console.log(`I got a message from ws. ${JSON.stringify(e.data)}`);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment