Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function sendBinaryMessage() {
if (websocket.readyState != WebSocket.OPEN)
return;
var sourceCanvas = document.getElementById('source');
// msToBlob returns a blob object from a canvas image or drawing
websocket.send(sourceCanvas.toBlob());
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment