{"id":18175,"library":"braid-http","title":"Braid-HTTP","description":"A ponyfill library extending browser and Node.js HTTP implementations to support Braid-HTTP, turning state transfer into state synchronization. Currently at version 1.3.125, with regular releases. Key differentiators: drop-in replacement for fetch() in browsers, adds capabilities to Node.js http/https/http2 modules, conforms to Braid-HTTP v04 spec with HTTP Multiresponse and Multiplexing extensions. Compared to alternatives, this is the primary implementation of the Braid protocol, providing subscription-based real-time updates and automatic reconnection.","status":"active","version":"1.3.125","language":"javascript","source_language":"en","source_url":"https://github.com/braid-org/braid-http","tags":["javascript","typescript"],"install":[{"cmd":"npm install braid-http","lang":"bash","label":"npm"},{"cmd":"yarn add braid-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add braid-http","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Used internally for fetch ponyfill in browsers","package":"fetch-ponyfill","optional":false}],"imports":[{"note":"Default export not available; named import required. In CJS, use destructuring.","wrong":"const braid = require('braid-http'); braid.fetch()","symbol":"fetch","correct":"import { fetch } from 'braid-http'"},{"note":"Not a default export; always named import.","wrong":"import http_client from 'braid-http'","symbol":"http_client","correct":"import { http_client } from 'braid-http'"},{"note":"Also works with require destructuring.","wrong":"const { http_server } = require('braid-http')","symbol":"http_server","correct":"import { http_server } from 'braid-http'"}],"quickstart":{"code":"import { fetch } from 'braid-http'\n\nasync function subscribeToChat() {\n  const response = await fetch('https://braid.org/chat', {\n    subscribe: true,\n    retry: true\n  })\n  response.subscribe((update) => {\n    console.log('New update:', update)\n  })\n}\n\nsubscribeToChat()","lang":"typescript","description":"Demonstrates subscribing to a resource with automatic reconnection."},"warnings":[{"fix":"Use 'import { fetch } from 'braid-http'' instead of 'import braidFetch from 'braid-http''.","message":"The 'braid-http' module does not export a default; always use named imports.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use <script src='https://unpkg.com/braid-http/braid-http-client.js'></script> then window.fetch = braid_fetch.","message":"Browser usage requires a script tag with unpkg. The global 'braid_fetch' is the replacement for window.fetch.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use 'if (update.patches) { ... } else { ... }' to handle patches vs. full body.","message":"The 'response.subscribe' callback receives an update object that may contain 'patches' or 'body', but not both. Check for existence of 'patches' to differentiate.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Set 'parents: () => current_parents' to dynamically update version on reconnect.","message":"The 'parents' option in fetch can be a function returning current parents, not just a static array.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use 'const { fetch } = require('braid-http')' for CJS or 'import { fetch } from 'braid-http'' for ESM.","message":"Node.js usage requires installing the package and importing via require or ESM.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'1.3.125':27 'add':41 'altern':62 'automat':81 'base':75 'braid':2,16,50,70 'braid-http':1,15,49 'browser':8,40 'capabl':42 'compar':60 'conform':47 'current':24 'differenti':32 'drop':34 'drop-in':33 'extend':7 'extens':59 'fetch':38 'http':3,11,17,51,55 'http/https/http2':45 'implement':12,67 'javascript':83 'key':31 'librari':6 'modul':46 'multiplex':58 'multirespons':56 'node.js':10,44 'ponyfil':5 'primari':66 'protocol':71 'provid':72 'real':77 'real-tim':76 'reconnect':82 'regular':29 'releas':30 'replac':36 'spec':53 'state':19,22 'subscript':74 'subscription-bas':73 'support':14 'synchron':23 'time':78 'transfer':20 'turn':18 'typescript':84 'updat':79 'v04':52 'version':26","created_at":"2026-04-25T07:36:52.498825+00:00","updated_at":"2026-04-25T07:36:52.498825+00:00","problems":[{"fix":"Run 'npm install braid-http' and ensure import path is correct.","cause":"Package not installed or incorrectly imported.","error":"Cannot find module 'braid-http'"},{"fix":"Use 'import { fetch } from 'braid-http'' instead of 'import braid_http from 'braid-http''.","cause":"Using default import instead of named import.","error":"TypeError: braid_http.fetch is not a function"},{"fix":"Include <script src='https://unpkg.com/braid-http/braid-http-client.js'></script> before calling braid_fetch.","cause":"Script tag missing or not loaded before execution.","error":"Uncaught ReferenceError: braid_fetch is not defined"},{"fix":"Ensure you are using the braid-http fetch: 'import { fetch } from 'braid-http''.","cause":"Using native browser fetch instead of braid-http's fetch.","error":"Failed to fetch: The 'subscribe' option is not supported by this version of fetch"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://braid.org","github":"https://github.com/braid-org/braid-http","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/braid-http","openapi_spec":null,"status_page":null,"smithery":null,"categories":["http-networking","communication","serialization"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}