Skip to content

Instantly share code, notes, and snippets.

@suissa
Created October 12, 2016 02:45
Show Gist options
  • Save suissa/ef302c833352e8435bd46acbc0b577db to your computer and use it in GitHub Desktop.
Save suissa/ef302c833352e8435bd46acbc0b577db to your computer and use it in GitHub Desktop.
<!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