Friday, 17 March 2017

var output of .JS to io.emit.

I'm working with socket.io now and node.js and wan't to send my value from a colorpicker.js script via socket to a client page.

I know that you can use .emit as a function to send messages.

// sending to all clients, include sender
io.emit('message', "this is a test");

// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");

But how can I use the var hexString as a message with nodejs/socket?

<script>
    // hex string:
    var hexString = colorWheel.color.hexString;
    // hexString = "#ffff00"
</script>



via RRG

No comments:

Post a Comment