Registry / messaging / ssb-fetch

ssb-fetch

JSON →
library1.5.2jsnpmunverified

ssb-fetch (v1.5.2) is a JavaScript library that enables using the browser's native fetch API to retrieve SSB (Secure Scuttlebutt) messages and blobs via ssb:// URLs. It provides a proxy server for development with tools like Insomnia and Postman, and plans to support PUT, POST, and DELETE for publishing. Stable with incremental updates, it differentiates by offering a standards-based approach to SSB interaction, utilizing fetch instead of custom protocols. Currently GET is stable; publishing via HTTP verbs is in design.

npm install ssb-fetch
INSTALL
IMPORT
SIG · SSB-FETCH
S
ssb-fetch
messagingjavascriptv1.5.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

proxy
npm run proxy
node proxy.js
Proxy server started via npm script; no direct import needed for client-side fetch usage.
fetch
fetch('ssb://message/...')
require('ssb-fetch')
Library polyfills fetch for ssb:// scheme; no import needed, just use fetch directly after including the library in browser/Agregore.
convertUri
import { convertUri } from 'ssb-uri2'
const convertUri = require('ssb-uri2')
Use ssb-uri2 to convert sigil IDs to URIs; ssb-fetch itself does not export this.

Shows how to start the proxy server and use fetch to retrieve an SSB message via HTTP or directly in Agregore.

// 1. Start the proxy server (in a separate terminal): // npm run proxy // 2. In your JavaScript (browser or Agregore), fetch SSB messages via HTTP proxy: const response = await fetch('http://localhost:4080/ssb://message/ssb:message/g3hPVPDEO1tRbWrY7wPZ4k9R9P3Y6qF6Y6qF6Y6qF6Y='); const data = await response.json(); console.log(data); // Alternatively, directly fetch ssb:// URIs in Agregore Browser: // const response = await fetch('ssb://message/g3hPVPDEO1tRbWrY7wPZ4k9R9P3Y6qF6Y6qF6Y6qF6Y='); // const data = await response.json(); // console.log(data);
Debug
Known issues
breakingssb:// URIs are required; old sigil IDs (@, %, &) are not supported directly.
fix
Convert sigil IDs to ssb:// URIs using ssb-uri2.
affects: >=1.0.0
gotchaProxy only works for GET requests; PUT/POST/DELETE for publishing not yet implemented.
fix
Use other methods (e.g., SSB client library) for publishing.
affects: 1.5.2
gotchaThe proxy server defaults to port 4080; if busy, you must manually set a different port.
fix
Modify proxy script or set PORT environment variable.
affects: >=1.0.0
deprecatedPlanned support for HTML form submissions (method='post') is not yet available.
fix
Use fetch with JSON body for now.
affects: 1.5.2
gotchassb_appname environment variable must match the SSB app name (default 'ssb') or data directory will be wrong.
fix
Set ssb_appname to the correct name (e.g., 'ssb-test') before starting proxy.
affects: >=1.0.0
Errors
Common errors & fixes
Error: connect ECONNREFUSED 127.0.0.1:4080
Proxy server not running or wrong port.
fix
Run 'npm run proxy' in separate terminal; ensure port 4080 is free.
TypeError: Failed to fetch
Invalid ssb:// URI or resource not found.
fix
Verify URI is correct and message/blob exists on your SSB node.
Error: Invalid URI scheme
Using non-ssb:// URI with direct fetch in Agregore (e.g., http://).
fix
Use proxy for http:// or ensure you're in Agregore browser that supports ssb:// scheme.
Upgrade
Version history
1.5.2latest on npm
Audit
Dependencies
ssb-uri2optionalUtility to convert SSB sigil IDs to ssb:// URIs, used in proxy and client-side URL conversion.
Agent activity
20 hits · last 30 days
node
18
Amazon
1
OpenAI (training)
1
Resources
ssb-fetch — npm install ssb-fetch · libregistry