add more nodejs instrumentation
This commit is contained in:
42
index.html
42
index.html
@@ -3,13 +3,45 @@
|
||||
<script src="/socket.io/socket.io.js"></script>
|
||||
<script>
|
||||
var socket = io();
|
||||
console.log("loaded socketio");
|
||||
// console.log("loaded socketio");
|
||||
|
||||
// connect to socketio
|
||||
socket.on('connect', function(){
|
||||
socket.send('hi');
|
||||
socket.on('data', function(data){
|
||||
console.log(data);
|
||||
});
|
||||
// send connect message
|
||||
socket.send('hi '+window.location);
|
||||
});
|
||||
window.onload = function(){
|
||||
cons = document.getElementById("console");
|
||||
// handle user input
|
||||
cons.onsubmit = function(){
|
||||
inp = document.getElementById("input")
|
||||
scr = document.getElementById("screen")
|
||||
// send input to socketio
|
||||
socket.emit('data',inp.value);
|
||||
// console.log(inp.value);
|
||||
scr.value += "> "+inp.value+"\r";
|
||||
scr.scrollTop = scr.scrollHeight;
|
||||
inp.value = "";
|
||||
return false;
|
||||
};
|
||||
scr = document.getElementById("screen")
|
||||
scr.value = ""; // reset input onload
|
||||
// log data from socket
|
||||
socket.on('data', function(data){
|
||||
// console.log(data);
|
||||
scr.value += "< "+data+"\r";
|
||||
scr.scrollTop = scr.scrollHeight;
|
||||
});
|
||||
// log connect messages
|
||||
socket.on('message', function(data){
|
||||
console.log('message',window.location,data);
|
||||
});
|
||||
};
|
||||
</script>
|
||||
</head>
|
||||
<form id="console">
|
||||
<textarea cols=80 rows=20 id="screen"></textarea><br/>
|
||||
<input id="input" type="text" />
|
||||
<input id="submit" type="button" value="Submit" />
|
||||
</form>
|
||||
</html>
|
||||
Reference in New Issue
Block a user