What is this?
DrunkSophey is a Node.js client library for the Pika Radio tunneling service. Think of it as a designated driver for your data packets — it handles the secure tunnel between your app and the Pika infrastructure so you can stream, broadcast, or proxy without setting up Shoutcast, Icecast or any other rented streaming server.
It is the same engine that powers the Pika Radio desktop app — packaged as a library so you can wire it into your own automations, bots, or services.
Installation
One install, two flavors. Pick your package manager:
npm install drunksopheypnpm add drunksopheyRequires Node.js 18 or newer. Yes, the package is really called drunksophey. Yes, it works sober too.
Usage
The "just works" method
For when you want a tunnel up in one line:
npx drunksophey --port 8080The "programmatic" method
For real apps where you want full control:
import DrunkSophey from 'drunksophey';
const client = new DrunkSophey();
async function start() {
// Guest login — no account required
const user = await client.guestLogin();
console.log(`Logged in as ${user.subdomain}`);
// Open the tunnel
const url = await client.startTunnel(8080);
console.log(`Tunnel open at ${url}`);
}
start();The returned URL is your public endpoint — you can share it, paste it into 3DXChat, or send it to whatever service needs it.
API Reference
Five methods, no surprises. All async, all promise-based.
- guestLogin()
- Promise<User>
- Creates a temporary guest account with a random subdomain. Sessions expire after 24 hours.
- login(username, password)
- Promise<User>
- Authenticates with a registered account. Returns the user object including the persistent subdomain.
- startTunnel(port, options?)
- Promise<string>
- Opens a tunnel to the given local port. Resolves to the public URL.
- stopTunnel()
- Promise<void>
- Cleanly tears down the tunnel and releases the subdomain.
- disconnect()
- void
- Hard disconnect — closes everything immediately.
Errors
Errors are thrown as DrunkSopheyError instances with a code field:
try {
await client.startTunnel(8080);
} catch (err) {
if (err.code === 'PORT_IN_USE') {
// handle conflict
}
}Common error codes
- AUTH_FAILED
- Wrong credentials or expired guest session.
- PORT_IN_USE
- Another process is bound to the local port.
- TUNNEL_TIMEOUT
- The Pika edge took too long to respond — retry.
- RATE_LIMITED
- You hit the connection rate limit. Slow down.
Found a bug or missing feature? Drop a message — DrunkSophey is hobby software, but bug reports are taken seriously.