Created
October 12, 2016 02:45
-
-
Save suissa/ef302c833352e8435bd46acbc0b577db 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 lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Workshop Socket.io - Events</title> | |
</head> | |
<body> | |
<h1>socket.io - Events</h1> | |
<p id="console"></p> | |
<script src="/socket.io/socket.io.js"></script> | |
<script> | |
const socket = io.connect('http://localhost:8080'); | |
const html = document.getElementById('console') | |
socket.on('connect', function(){ | |
console.log('connectou') | |
html.innerHTML += 'connectou \r\n' | |
socket.emit('connect-client', Date.now()); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment