not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

47 lines
1.0 KiB

<!DOCTYPE html>
<html>
<head>
<title>Hello world</title>
</head>
<script src = "../../socket.io/socket.io.js"></script>
<script>
var socket = io();
socket.emit('register', 'jeff');
var join = function(name)
{
var obj = new Object();
obj.roomName = name;
obj.password = '';
socket.emit('joinRoom', obj);
}
socket.on('sendRooms', function(data)
{
console.log("got rooms");
console.log(data);
//document.write(data);
data.rooms.forEach(function(r)
{
document.write("<input type=\"submit\" value=\"Join Room" + r.name + "\" onclick=\"join(\"" + r.name + "\")\">");
document.write(r.name)
document.write("<br />");
});
var tt = new Object();
tt.roomName = "den";
tt.password = "pp";
socket.emit('createRoom', tt);
});
socket.on('roomUpdate', function(data)
{
console.log("good");
console.log(data);
});
</script>
<body>Hello world</body>
</html>