Skip to content
Zachary Boyd edited this page Sep 13, 2018 · 1 revision

A JSON-RPC 2 TCP Server will listen on port 9077 by default. Via the RPC server, a client can add/remove Tor instances and get a new identity while Tor Router is running. The control server will also accept WebSocket connections if the --websocketControlHost or -w flag is set.

Example (in node):

	const net = require('net');

	let client = net.createConnection({ port: 9077 }, () => {
		let rpcRequest = {
			"method": "createInstances",
			"params": [3], 
			"jsonrpc":"2.0", 
			"id": 1
		};
		client.write(JSON.stringify(rpcRequest));
	});

	client.on('data', (chunk) => {
		let rawResponse = chunk.toString('utf8');
		let rpcResponse = JSON.parse(rawResponse);
		console.log(rpcResponse)
		if (rpcResponse.id === 1) {
			console.log('Three instances have been created!')
		}
	})

A full list of available RPC Methods can be found here

Clone this wiki locally