99- ⚡ ** Native Performance** — 50-100x faster than curl-impersonate (no process spawning)
1010- 🔒 ** TLS Fingerprinting** — Perfect JA3/JA4 signatures matching real browsers
1111- 🌐 ** HTTP/2 Fingerprinting** — Authentic SETTINGS frames, PRIORITY, and header ordering
12- - 🎭 ** Multiple Browser Profiles** — Chrome, Firefox, Safari, Edge
12+ - 🎭 ** Multiple Browser Profiles** — Chrome, Firefox, Safari, Edge, Opera, OkHttp (78+ profiles)
13+ - 🔌 ** WebSocket Support**
1314- 📦 ** Zero Dependencies** — Pure Rust with BoringSSL under the hood
1415- 💎 ** TypeScript Support** — Full type definitions included
1516- 🛡️ ** Protection Bypass** — Cloudflare, Akamai, and other anti-bot systems
@@ -118,12 +119,41 @@ import { request } from 'node-wreq';
118119const response = await request ({
119120 url: ' https://example.com' ,
120121 browser: ' chrome_137' ,
121- proxy?: ' http://proxy.example.com:8080' ,
122- // or with authentication:
122+ // proxy: 'http://proxy.example.com:8080',
123123 // proxy: 'http://username:password@proxy.example.com:8080',
124+ // proxy: 'socks5://proxy.example.com:1080',
124125});
125126```
126127
128+ ### WebSocket Connection
129+
130+ ``` typescript
131+ import { websocket } from ' node-wreq' ;
132+
133+ const ws = await websocket ({
134+ url: ' wss://echo.websocket.org' ,
135+ browser: ' chrome_137' ,
136+ onMessage : (data ) => {
137+ console .log (' Received:' , data );
138+ },
139+ onClose : () => {
140+ console .log (' Connection closed' );
141+ },
142+ onError : (error ) => {
143+ console .error (' Error:' , error );
144+ },
145+ });
146+
147+ // Send text message
148+ await ws .send (' Hello!' );
149+
150+ // Send binary message
151+ await ws .send (Buffer .from ([1 , 2 , 3 ]));
152+
153+ // Close connection
154+ await ws .close ();
155+ ```
156+
127157## 📚 API Reference
128158
129159### ` request(options: ` [ ` RequestOptions ` ] ( #requestoptions ) ` ): Promise< ` [ ` Response ` ] ( #response ) ` > `
@@ -162,6 +192,33 @@ interface Response {
162192
163193### ` post(url: string, body?: string, options?): Promise< ` [ ` Response ` ] ( #response ) ` > `
164194
195+ ### ` websocket(options: ` [ ` WebSocketOptions ` ] ( #websocketoptions ) ` ): Promise<WebSocket> `
196+
197+
198+ ** Options:**
199+ <a name =" websocketoptions " ></a >
200+
201+ ``` typescript
202+ interface WebSocketOptions {
203+ url: string ; // Required: WebSocket URL (ws:// or wss://)
204+ browser? : BrowserProfile ; // Default: 'chrome_137'
205+ headers? : Record <string , string >;
206+ proxy? : string ; // HTTP/HTTPS/SOCKS5 proxy URL
207+ onMessage: (data : string | Buffer ) => void ; // Required: Message callback
208+ onClose? : () => void ; // Optional: Close callback
209+ onError? : (error : string ) => void ; // Optional: Error callback
210+ }
211+ ```
212+
213+ ** WebSocket Methods:**
214+
215+ ``` typescript
216+ class WebSocket {
217+ send(data : string | Buffer ): Promise <void >;
218+ close(): Promise <void >;
219+ }
220+ ```
221+
165222### ` getProfiles(): ` [ ` BrowserProfile[] ` ] ( #browser-profiles )
166223
167224Get list of available browser profiles.
@@ -170,6 +227,7 @@ Get list of available browser profiles.
170227import { getProfiles } from ' node-wreq' ;
171228
172229const profiles = getProfiles ();
230+
173231console .log (profiles );
174232// ['chrome_100', 'chrome_101', ..., 'chrome_137', 'edge_101', ..., 'safari_18', ...]
175233```
0 commit comments