Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created July 5, 2018 02:53
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 goofmint/e4d467640caa99e3c445f3fef910735b to your computer and use it in GitHub Desktop.
Save goofmint/e4d467640caa99e3c445f3fef910735b to your computer and use it in GitHub Desktop.
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