mirror of
https://git.mirrors.martin98.com/https://github.com/mendableai/firecrawl
synced 2025-08-12 15:19:03 +08:00
Fix bad WebSocket URL in CrawlWatcher (#1053)
* fix: bad websocket url in crawl watcher Fixed CrawlWatcher creating WebSocket using standard http url from base app. * Use regex to improve url replacement
This commit is contained in:
parent
6b9e65c4f6
commit
b8c4e198d1
@ -1298,7 +1298,9 @@ export class CrawlWatcher extends TypedEventTarget<CrawlWatcherEvents> {
|
|||||||
constructor(id: string, app: FirecrawlApp) {
|
constructor(id: string, app: FirecrawlApp) {
|
||||||
super();
|
super();
|
||||||
this.id = id;
|
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.status = "scraping";
|
||||||
this.data = [];
|
this.data = [];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user