1.0.2 • Published 4 years ago
puppeteer_hub_client v1.0.2
puppeteer-hub-client
puppeteer-hub-client is the client package for puppeteer-hub, which provides the registering nodes, acquiring nodes, releasing nodes, and getting node list APIs for browserless node.
Usage
get nodes list:
import { PuppeteerHubClient } from 'puppeteer_hub_client';
await puppeteerHubClient.getNodeList();
acquire nodes:
- browserType: browser type, eg: chrome, firefox, electron, etc.
- system: platform os system type, eg: mac, linux, docker.
- maxConcurrentSessions: max browsers connection number requirements for the browser node.
- expiredAt: specify the expiration time(minute).
- priority: specify the os system with high priority to get.
await puppeteerHubClient.acquireNode({priority: 'windows', expiredAt: 1, sessionMode: 'simple', maxConcurrentSessions: 1});
release nodes:
- sessionID: the node session ID to be released.
- all: true, if you want to release all active nodes, default false.
await puppeteerHubClient.releaseNode('8171cbed-511a-4013-9d8e-5e3c03ca6074', 'true');