Created
March 23, 2016 21:01
-
-
Save lmccart/eda70f9c50dd542b644d 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
<!doctype html> | |
<html> | |
<head> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.23/p5.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.4.23/addons/p5.dom.js"></script> | |
<script src="https://cdn.socket.io/socket.io-1.4.5.js"></script> | |
<script> | |
var socket = io(); | |
socket.on('chat message', function(msg){ | |
createDiv(msg); | |
}); | |
var input; | |
var button; | |
function setup() { | |
noCanvas(); | |
input = createInput(); | |
button = createButton('send'); | |
button.mousePressed(send); | |
} | |
function send() { | |
var val = input.value(); | |
input.value(''); | |
socket.emit('chat message', val); | |
} | |
</script> | |
<style> | |
body { margin: 0; padding: 0; } | |
</style> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment