client Class APE.PipeProxy

Summary

Extends:
File
<./src/Ape_Jsf/Source/Pipe/PipeProxy.js>

PipeProxy Class Detail

APE.PipeProxy ()
ProxyPipe object
File:
<./src/Ape_Jsf/Source/Pipe/PipeProxy.js>
See:

Summary

Own
Methods Attributes Methods Name Methods Description
<static>   APE.PipeProxy. open (host, port) Open a new proxy connection to a IP:Port

This is actually the constructor

<static>   APE.PipeProxy. send (data) Send data to a proxy
Inherrited

<static> {APE.PipeProxy} APE.PipeProxy. open (host, port)

Open a new proxy connection to a IP:Port

This is actually the constructor

Parameters:
{string} host Hostname or ip-address
{integer} port Port
Returns:
{APE.PipeProxy} a APE.PipeProxy object
Example
//ape var is a reference to APE instance
//Connect to the APE server
ape.start();
//Connect to proxy when the client is connected to the server
ape.addEvent('init', function() {
		//Connect to freenode irc
		var proxy = new APE.PipeProxy();
		proxy.open('irc.freenode.net', 6667);
	});
//Intercept proxy event
ape.addEvent('proxyConnect', function() {
		console.log('you are now connected to proxy');
	});
ape.addEvent('proxyRead', function(data) {
		console.log('Receiving data', data);
});

<static> {void} APE.PipeProxy. send (data)

Send data to a proxy
Parameters:
{string} data The data string to send. The data wil be b64 encoded and send with a SEND CMD
Returns:
{void}
Example
//ape var is a reference to APE instance
ape.start();
var proxy;
ape.addEvent('init', function() {
	//Connect to the APE server
	proxy = new APE.PipeProxy();
	//Connect to ape-project website
	proxy.connect('www.ape-project.org', 80);
});
//Send HTTP headers
proxy.write("GET / HTTP1.1\r\nhost: www.ape-project.org\n\n");
ape.addEvent('proxyConnect', function() {
	console.log('you are now connected to proxy');
});
//Receive the page content
ape.addEvent('proxyRead', function(data) {
	console.log('Receiving data', data);
});
ape.addEvent('proxyClose', function() {
	console.log('Proxy closed the connection');
});