@fazzcode/baileys 2.5.5 → 2.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.MD CHANGED
@@ -937,6 +937,21 @@ npm install @fazzcode/baileys
937
937
 
938
938
  Pastikan juga koneksi internet stabil selama proses install karena beberapa dependency (terutama yang diambil dari GitHub seperti `libsignal-xeuka`) butuh proses clone/download yang agak besar.
939
939
 
940
+ ### Troubleshooting "Connection Closed" / Koneksi Tidak Mau Tersambung
941
+
942
+ Kalau koneksi terus-terusan putus sebelum berhasil login/pairing (baik muncul error `Connection Closed` maupun cuma diam tanpa respons), berarti koneksi WebSocket ke server WhatsApp gagal terbentuk. Penyebab paling umum:
943
+
944
+ - **Internet tidak stabil** atau koneksi terlalu lambat saat proses handshake awal
945
+ - **Firewall/ISP/provider data** memblokir akses ke `web.whatsapp.com` (lumayan sering terjadi di beberapa jaringan kampus/kantor/operator seluler tertentu)
946
+ - **VPN/Proxy** yang dipakai memblokir atau memodifikasi traffic WebSocket
947
+
948
+ Cara cek & atasi:
949
+
950
+ 1. Pastikan kamu bisa akses `https://web.whatsapp.com` lewat browser di perangkat yang sama.
951
+ 2. Kalau pakai VPN/proxy, coba matikan dulu lalu jalankan ulang bot.
952
+ 3. Coba ganti jaringan (misal dari WiFi ke data seluler, atau sebaliknya) untuk memastikan bukan masalah jaringan spesifik.
953
+ 4. Library ini sudah dilengkapi penanganan kalau server membalas dengan response HTTP yang tidak terduga (misalnya diblokir oleh jaringan), jadi error akan langsung ditampilkan dengan jelas alih-alih bot diam tanpa sebab — perhatikan kode status yang muncul di log untuk diagnosis lebih lanjut.
954
+
940
955
  ### Basic Error Handling
941
956
 
942
957
  ```javascript
@@ -640,6 +640,18 @@ const toPn = async (pn) => {
640
640
  });
641
641
  ws.on("error", mapWebSocketError(end));
642
642
  ws.on("close", () => end(new Boom("Connection Terminated", { statusCode: DisconnectReason.connectionClosed })));
643
+ ws.on("unexpected-response", (req, res) => {
644
+ const statusCode = res?.statusCode || DisconnectReason.connectionClosed;
645
+ const denyReason = res?.headers?.["x-deny-reason"];
646
+ logger.error({ statusCode, denyReason }, "unexpected (non-websocket) response received during handshake");
647
+ try {
648
+ res?.resume?.();
649
+ }
650
+ catch {
651
+ // ignore, just making sure the socket isn't left dangling
652
+ }
653
+ end(new Boom(`Unexpected server response: ${statusCode}`, { statusCode: DisconnectReason.connectionClosed, data: { httpStatusCode: statusCode, denyReason } }));
654
+ });
643
655
  ws.on("CB:xmlstreamend", () => end(new Boom("Connection Terminated by Server", { statusCode: DisconnectReason.connectionClosed })));
644
656
  ws.on("CB:iq,type:set,pair-device", async (stanza) => {
645
657
  const iq = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fazzcode/baileys",
3
- "version": "2.5.5",
3
+ "version": "2.5.6",
4
4
  "description": "Websocket Whatsapp API for Node.js",
5
5
  "keywords": [
6
6
  "whatsapp",