Skip to content

Instantly share code, notes, and snippets.

@lmccart
Created March 23, 2016 21:01
Show Gist options
  • Save lmccart/eda70f9c50dd542b644d to your computer and use it in GitHub Desktop.
Save lmccart/eda70f9c50dd542b644d to your computer and use it in GitHub Desktop.
<!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