Skip to main content

Overview

PalanK exposes a local API that allows external applications to leverage its browser automation capabilities. The API communicates via WebSocket with the local Gateway server.
The API is designed for local integrations only. All connections are restricted to 127.0.0.1.

Architecture

Connection

WebSocket Endpoint

ws://127.0.0.1:18792/extension

HTTP Health Check

GET http://127.0.0.1:18792/
Returns 200 OK if the Gateway is running.

Message Format

All messages use JSON format:

Request

{
  "id": 1,
  "method": "forwardCDPCommand",
  "params": {
    "method": "Page.navigate",
    "params": {
      "url": "https://example.com"
    }
  }
}

Response

{
  "id": 1,
  "result": {
    "frameId": "ABC123",
    "loaderId": "DEF456"
  }
}

Error Response

{
  "id": 1,
  "error": "No attached tab for method Page.navigate"
}

Quick Start

const WebSocket = require('ws');

const ws = new WebSocket('ws://127.0.0.1:18792/extension');

ws.on('open', () => {
  ws.send(JSON.stringify({
    id: 1,
    method: 'forwardCDPCommand',
    params: {
      method: 'Page.navigate',
      params: { url: 'https://google.com' }
    }
  }));
});

ws.on('message', (data) => {
  console.log('Response:', JSON.parse(data));
});

Available Methods

CategoryMethods
NavigationPage.navigate, Page.reload, Page.goBack, Page.goForward
DOMDOM.getDocument, DOM.querySelector, DOM.getOuterHTML
InputInput.dispatchMouseEvent, Input.dispatchKeyEvent
RuntimeRuntime.evaluate, Runtime.callFunctionOn
TargetTarget.createTarget, Target.closeTarget, Target.activateTarget
The API supports most Chrome DevTools Protocol methods.

Next Steps