From Ape Wiki
[edit] What is TCPSocket?
APE provides a cool API : bring sockets to JavaScript on the client-side.
What does it mean? You can connect to any TCP server from the browser.
[edit] Configuration (server side)
You need to include "commands/proxy.js" in ./APE_Server/scripts/main.ape.js
Ape.addEvent("init", function() { include("framework/mootools.js"); include("utils/utils.js"); include("commands/proxy.js"); });
Security :
You have to list all host/ip:port that are allowed to be contacted : edit ./APE_Server/modules/conf/proxy.conf
[edit] HOWTO (client side)
<!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; 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>


