rayobrowse
v0.2.0
Published
Node.js/TypeScript SDK for Rayobrowse Cloud browser platform
Maintainers
Readme
rayobrowse
Node.js/TypeScript SDK for the Rayobrowse stealth browser platform.
Installation
npm install rayobrowseQuick Start
import { Rayobrowse } from 'rayobrowse';
import { chromium } from 'playwright';
const rb = new Rayobrowse({
endpoint: 'wss://cloud.rayobrowse.com',
apiKey: 'your-api-key',
});
const cdpUrl = await rb.connectUrl({ os: 'windows' });
const browser = await chromium.connectOverCDP(cdpUrl);
const page = await browser.newPage();
await page.goto('https://example.com');
console.log(await page.title());
await browser.close();
await rb.close();API
new Rayobrowse({ endpoint, apiKey })
Create a client instance.
connectUrl(options?)
Create a browser and return the CDP WebSocket URL. Pass it to Playwright's connectOverCDP or Puppeteer's connect.
Options: backend, os, proxy, headless, maxLifetime, vnc, metadata, protection, etc.
reconnectUrl(sessionId)
Reconnect to an existing session by ID.
close(sessionId?)
Destroy a browser session. Defaults to the last created session.
listBrowsers()
Get pool/backend overview.
getHealth()
Check gateway health.
getSessionCount()
Check remaining concurrency: { limit, remaining }.
Error Handling
import { ConcurrencyLimitError, RateLimitError, AuthError } from 'rayobrowse';
try {
const cdpUrl = await rb.connectUrl();
} catch (err) {
if (err instanceof ConcurrencyLimitError) {
console.log(`Limit reached: ${err.active}/${err.limit}, retry in ${err.retryAfter}s`);
} else if (err instanceof RateLimitError) {
console.log(`Rate limited, retry in ${err.retryAfter}s`);
} else if (err instanceof AuthError) {
console.log('Invalid API key');
}
}Documentation
Full documentation, API reference, and integration guides are available at docs.rayobrowse.com.
