Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥
TypeScript aiai-agentsai-crawlerai-scrapingai-searchcrawlerdata-extractionhtml-to-markdownllmmarkdownscraperscrapingweb-crawlerweb-dataweb-data-extractionweb-scraperweb-scrapingweb-searchwebscraping
Fix bad WebSocket URL in CrawlWatcher (#1053)
Hercules Smithb8c4e198d15d
diff --git a/apps/js-sdk/firecrawl/src/index.ts b/apps/js-sdk/firecrawl/src/index.tsindex 3deeb909b..58f772112 100644--- a/apps/js-sdk/firecrawl/src/index.ts+++ b/apps/js-sdk/firecrawl/src/index.ts@@ -1298,7 +1298,9 @@ export class CrawlWatcher extends TypedEventTarget<CrawlWatcherEvents> {constructor(id: string, app: FirecrawlApp) {super();this.id = id;- this.ws = new WebSocket(`${app.apiUrl}/v1/crawl/${id}`, app.apiKey);+ // replace `http` with `ws` (`http://` -> `ws://` and `https://` -> `wss://`)+ const wsUrl = app.apiUrl.replace(/^http/, "ws");+ this.ws = new WebSocket(`${wsUrl}/v1/crawl/${id}`, app.apiKey);this.status = "scraping";this.data = [];