Skip to content

Instantly share code, notes, and snippets.

@paraboul
Created January 27, 2010 06:26
Show Gist options
  • Save paraboul/287585 to your computer and use it in GitHub Desktop.
Save paraboul/287585 to your computer and use it in GitHub Desktop.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="demo.css" media="screen" title="Normal" />
<script type="text/javaScript" src="../../Clients/JavaScript.js"></script>
<script type="text/javaScript" src="../config.js"></script>
</head>
<body>
<div id="ape_master_container"></div>
<script type="text/javaScript">
// Initialize APE_Client
var client = new APE.Client();
var TCPSocket = null;
APE.Config.transport = 0; /* Use websockets */
client.load();
client.addEvent('load', function() {
TCPSocket = this.core.TCPSocket;
this.core.start();
});
client.addEvent('ready', function() {
var socket = new TCPSocket();
socket.open('google.com', 80);
socket.onopen = function() {
console.log('connected');
socket.send("GET / HTTP/1.1\r\nHost: google.com\r\n\r\n");
}
socket.onread = function(data) {
console.log("read : " + data);
}
socket.onclose = function() {
console.log("closed");
}
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment