fbchat-v2 2.3.3__tar.gz → 2.3.4__tar.gz

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.
Files changed (63) hide show
  1. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/.gitignore +2 -1
  2. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/CHANGELOG.md +36 -0
  3. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/PKG-INFO +12 -8
  4. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/README.md +11 -7
  5. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/README_EN.md +12 -7
  6. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/pyproject.toml +1 -1
  7. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/__init__.py +3 -0
  8. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/__init__.py +1 -1
  9. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/README.md +10 -2
  10. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/README_EN.md +11 -2
  11. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/__init__.py +1 -0
  12. fbchat_v2-2.3.4/src/fbchat_v2/_messaging/_bridge_checksums.py +11 -0
  13. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_listening.py +257 -39
  14. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_listening_e2ee.py +749 -71
  15. fbchat_v2-2.3.4/src/fbchat_v2/_messaging/_reconnect.py +327 -0
  16. fbchat_v2-2.3.3/src/fbchat_v2/_messaging/_bridge_checksums.py +0 -11
  17. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/LICENSE +0 -0
  18. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/README.md +0 -0
  19. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/README_EN.md +0 -0
  20. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/_console.py +0 -0
  21. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/_facebookLogin.py +0 -0
  22. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/_http.py +0 -0
  23. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/_permissions.py +0 -0
  24. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/_session.py +0 -0
  25. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/_storage.py +0 -0
  26. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/_types.py +0 -0
  27. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_core/_utils.py +0 -0
  28. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/README.md +0 -0
  29. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/README_EN.md +0 -0
  30. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/__init__.py +0 -0
  31. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/README.md +0 -0
  32. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/README_EN.md +0 -0
  33. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/__init__.py +0 -0
  34. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_archivePost.py +0 -0
  35. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_blocking.py +0 -0
  36. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_changeBio.py +0 -0
  37. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_createPost.py +0 -0
  38. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_deletePost.py +0 -0
  39. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_get_user_info.py +0 -0
  40. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_marketplace.py +0 -0
  41. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_notification.py +0 -0
  42. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_professional.py +0 -0
  43. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_reactionPost.py +0 -0
  44. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_registerOnProfile.py +0 -0
  45. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_search.py +0 -0
  46. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_facebook/_unFriend.py +0 -0
  47. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_thread/__init__.py +0 -0
  48. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_thread/_addAdmin.py +0 -0
  49. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_thread/_all_thread_data.py +0 -0
  50. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_thread/_changeEmoji.py +0 -0
  51. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_thread/_changeNameThread.py +0 -0
  52. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_features/_thread/_changeNickname.py +0 -0
  53. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_attachments.py +0 -0
  54. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_bridge_actions.py +0 -0
  55. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_changeTheme.py +0 -0
  56. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_createNotes.py +0 -0
  57. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_editMessage.py +0 -0
  58. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_message_requests.py +0 -0
  59. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_reactions.py +0 -0
  60. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_send.py +0 -0
  61. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_send_e2ee.py +0 -0
  62. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/_messaging/_unsend.py +0 -0
  63. {fbchat_v2-2.3.3 → fbchat_v2-2.3.4}/src/fbchat_v2/py.typed +0 -0
@@ -41,6 +41,7 @@ venv.bak/
41
41
  *.log
42
42
  logs/
43
43
  .tmp/
44
+ /.state/
44
45
  *.sqlite3
45
46
  *.db
46
47
  *.db-journal
@@ -49,4 +50,4 @@ AGENT_MEMORYs.md
49
50
  .vbsec-tmp/
50
51
  vbsec-reports/
51
52
  src/test.py
52
- .understand-anything
53
+ .understand-anything
@@ -43,6 +43,42 @@ phiên bản tuân theo [Semantic Versioning](https://semver.org/lang/vi/).
43
43
  khoảng trắng thừa đầu hero, CSS variable thiếu, V2 badge bị ẩn và layout
44
44
  contributor/preloader trên màn hình nhỏ.
45
45
 
46
+ ## [2.3.4] - 2026-10-21
47
+
48
+ ### Added
49
+
50
+ - Thêm `ReconnectPolicy` cho MQTT/E2EE: retry khi startup mất mạng hoặc kết nối
51
+ bị ngắt, exponential backoff có jitter, delay trần và retry budget tùy chọn.
52
+ - Thêm `connection_state`, `connection_status` và callback trạng thái. Bridge
53
+ cung cấp capability `structuredConnectionStatus` cùng failure code an toàn,
54
+ không đưa cookie, ID hội thoại hoặc nội dung chat vào snapshot.
55
+ - Thêm test offline cho outage, startup retry, mất riêng socket E2EE, giới hạn
56
+ retry, stop/cancel và lọc message replay qua các generation của bridge.
57
+
58
+ ### Changed
59
+
60
+ - MQTT dùng một supervisor quản lý retry; giữ sync token/sequence và cache ID
61
+ có giới hạn qua reconnect. E2EE ưu tiên socket Go tự nối lại khi RPC còn khỏe,
62
+ chỉ thay process khi generation không thể dùng tiếp.
63
+ - Lỗi auth/checkpoint/config/protocol hoặc chưa phân loại được dừng rõ ràng,
64
+ không retry vô hạn. Lỗi chứng chỉ TLS được phân loại trước lỗi mạng chung.
65
+ - E2EE memory-only báo `device_state_lost` khi process chết, không tự pair mới
66
+ hoặc ghi key ra đĩa. Persistent device vẫn là lựa chọn chủ động của ứng dụng.
67
+ - Bot mẫu tiếp tục chờ khi startup đang reconnecting. Stop/cancel chờ worker
68
+ thu dọn, kể cả khi coroutine bị cancel nhiều lần.
69
+ - Nâng Go lên `1.26.10` để vá `GO-2026-6809` trong `crypto/x509`; giữ nguyên
70
+ vulnerability gate của CI.
71
+
72
+ ### Giới hạn
73
+
74
+ - Policy của wrapper không ghi đè backoff socket native Go. Với E2EE, retry
75
+ budget khi native reconnect đếm lượt quan sát, không phải số TCP attempt.
76
+ - Reconnect không đảm bảo nhận đủ mọi tin trong thời gian offline. Khi thay
77
+ process, listener báo nguy cơ message gap; tin gửi có kết quả `unknown`
78
+ không được tự gửi lại.
79
+ - Các thay đổi reconnect được kiểm bằng test offline. Cold restart sau payload
80
+ thật và mất mạng riêng bridge vẫn cần kiểm chứng live riêng.
81
+
46
82
  ## [2.3.3] - 2026-10-16
47
83
 
48
84
  ### Added
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: fbchat-v2
3
- Version: 2.3.3
3
+ Version: 2.3.4
4
4
  Summary: Async-first, account-based Python library for the unofficial Facebook Messenger API with E2EE support.
5
5
  Project-URL: Homepage, https://github.com/m008v/fbchat-v2
6
6
  Project-URL: Documentation, https://github.com/m008v/fbchat-v2/blob/main/DOCS.md
@@ -252,7 +252,7 @@ Description-Content-Type: text/markdown
252
252
  [![Status](https://img.shields.io/badge/status-active-22c55e)](https://github.com/m008v/fbchat-v2)
253
253
  [![PyPI](https://img.shields.io/pypi/v/fbchat-v2?color=3775A9&logo=pypi&logoColor=white)](https://pypi.org/project/fbchat-v2/)
254
254
  [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/)
255
- [![Version](https://img.shields.io/badge/version-2.3.3-blue)](https://github.com/m008v/fbchat-v2/releases)
255
+ [![Version](https://img.shields.io/badge/version-2.3.4-blue)](https://github.com/m008v/fbchat-v2/releases)
256
256
  [![Issues](https://img.shields.io/github/issues/m008v/fbchat-v2?color=orange)](https://github.com/m008v/fbchat-v2/issues)
257
257
  [![License](https://img.shields.io/badge/license-Xem%20LICENSE-lightgrey)](LICENSE)
258
258
  [![Telegram](https://img.shields.io/badge/Telegram-MinhHuyDev-26A5E4?logo=telegram&logoColor=white)](https://t.me/MinhHuyDev)
@@ -264,7 +264,7 @@ Description-Content-Type: text/markdown
264
264
  ---
265
265
 
266
266
  > [!IMPORTANT]
267
- > Bản 2.3.3 dùng `async/await`. Nếu đang dùng bản cũ, bạn cần sửa cách gọi hàm theo ví dụ bên dưới. Muốn giữ code đồng bộ thì dùng bản [v2.1.4](https://github.com/m008v/fbchat-v2/tree/v2.1.4).
267
+ > Bản 2.3.4 dùng `async/await`. Nếu đang dùng bản cũ, bạn cần sửa cách gọi hàm theo ví dụ bên dưới. Muốn giữ code đồng bộ thì dùng bản [v2.1.4](https://github.com/m008v/fbchat-v2/tree/v2.1.4).
268
268
 
269
269
  > [!WARNING]
270
270
  > Đây không phải sản phẩm chính thức của Facebook. Nếu cần API chatbot chính thức, xem [Messenger Platform](https://developers.facebook.com/docs/messenger-platform/). `fbchat-v2` dùng tài khoản và cookie Facebook cá nhân, nên có rủi ro với bảo mật phiên và tài khoản. Cân nhắc trước khi sử dụng.
@@ -276,6 +276,10 @@ Mình là MinhHuyDev (`m008v`), tác giả và người duy trì dự án.
276
276
 
277
277
  `fbchat-v2` là thư viện Python để gửi và nhận tin nhắn Messenger bằng tài khoản Facebook cá nhân. Thư viện dùng `async/await`; E2EE chạy qua bridge Go. Codebase đã được tổ chức lại từ v2.2.0 và tiếp tục được sửa theo các lỗi người dùng báo về.
278
278
 
279
+ Từ 2.3.4, MQTT/E2EE tự nối lại khi mất mạng, phân biệt lỗi cookie và có callback
280
+ trạng thái. Xem [cách cấu hình](DOCS.md#tự-nối-lại).
281
+ E2EE cần bridge 2.3.4; wrapper không dùng binary cũ thiếu contract reconnect.
282
+
279
283
  Cảm ơn mọi người đã góp ý và báo lỗi. Đây là API không chính thức nên một số chức năng có thể hỏng khi Facebook thay đổi. Nếu gặp lỗi, mở issue trên [GitHub](https://github.com/m008v/fbchat-v2/issues) kèm cách tái hiện và log đã che thông tin nhạy cảm, hoặc nhắn mình qua [Telegram](https://t.me/MinhHuyDev).
280
284
 
281
285
  ---
@@ -422,7 +426,7 @@ fbchat-v2/
422
426
  | Thành phần | Tối thiểu | Khuyến nghị | Ghi chú |
423
427
  |---|---|---|---|
424
428
  | Python | 3.10 | 3.11 / 3.12 | Bắt buộc |
425
- | Go (toolchain) | 1.26.9 | 1.26.9+ | **Chỉ cần cho E2EE** - để build `fbchat-bridge-e2ee` |
429
+ | Go (toolchain) | 1.26.10 | 1.26.10+ | **Chỉ cần cho E2EE** - để build `fbchat-bridge-e2ee` |
426
430
  | Git | bất kỳ | latest | Cần cho `go mod tidy` kéo `mautrix/meta` |
427
431
  | Hệ điều hành | Windows / Linux / macOS | - | - |
428
432
  | RAM | 256 MB | 1 GB+ | Bridge E2EE chiếm ~80–150 MB khi chạy |
@@ -501,7 +505,7 @@ Nếu chỉ dùng API HTTP hoặc listener MQTT thường, bạn có thể bỏ
501
505
 
502
506
  #### 5.1. Cài Go toolchain
503
507
 
504
- - Tải về: <https://go.dev/dl/> (Go ≥ 1.26.9).
508
+ - Tải về: <https://go.dev/dl/> (Go ≥ 1.26.10).
505
509
  - Sau khi cài, mở terminal mới và kiểm tra:
506
510
 
507
511
  ```bash
@@ -545,9 +549,9 @@ Lần build đầu mất vài phút (~300 MB cache Go module). Sau đó binary k
545
549
  ```bash
546
550
  cd ..
547
551
  # Windows
548
- python scripts/smoke_bridge_rpc.py .\build\fbchat-bridge-e2ee.exe --expected-version 2.3.3
552
+ python scripts/smoke_bridge_rpc.py .\build\fbchat-bridge-e2ee.exe --expected-version 2.3.4
549
553
  # Linux/macOS
550
- python scripts/smoke_bridge_rpc.py ./build/fbchat-bridge-e2ee --expected-version 2.3.3
554
+ python scripts/smoke_bridge_rpc.py ./build/fbchat-bridge-e2ee --expected-version 2.3.4
551
555
  ```
552
556
 
553
557
  Nếu binary không nằm ở vị trí mặc định, đặt biến môi trường:
@@ -851,7 +855,7 @@ ruff check src tests scripts
851
855
  black --check src tests scripts
852
856
  mypy
853
857
  python -m build --wheel
854
- python scripts/verify_distribution.py dist/fbchat_v2-2.3.3-py3-none-any.whl
858
+ python scripts/verify_distribution.py dist/fbchat_v2-2.3.4-py3-none-any.whl
855
859
  git diff --check
856
860
  ```
857
861
 
@@ -7,7 +7,7 @@
7
7
  [![Status](https://img.shields.io/badge/status-active-22c55e)](https://github.com/m008v/fbchat-v2)
8
8
  [![PyPI](https://img.shields.io/pypi/v/fbchat-v2?color=3775A9&logo=pypi&logoColor=white)](https://pypi.org/project/fbchat-v2/)
9
9
  [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/)
10
- [![Version](https://img.shields.io/badge/version-2.3.3-blue)](https://github.com/m008v/fbchat-v2/releases)
10
+ [![Version](https://img.shields.io/badge/version-2.3.4-blue)](https://github.com/m008v/fbchat-v2/releases)
11
11
  [![Issues](https://img.shields.io/github/issues/m008v/fbchat-v2?color=orange)](https://github.com/m008v/fbchat-v2/issues)
12
12
  [![License](https://img.shields.io/badge/license-Xem%20LICENSE-lightgrey)](LICENSE)
13
13
  [![Telegram](https://img.shields.io/badge/Telegram-MinhHuyDev-26A5E4?logo=telegram&logoColor=white)](https://t.me/MinhHuyDev)
@@ -19,7 +19,7 @@
19
19
  ---
20
20
 
21
21
  > [!IMPORTANT]
22
- > Bản 2.3.3 dùng `async/await`. Nếu đang dùng bản cũ, bạn cần sửa cách gọi hàm theo ví dụ bên dưới. Muốn giữ code đồng bộ thì dùng bản [v2.1.4](https://github.com/m008v/fbchat-v2/tree/v2.1.4).
22
+ > Bản 2.3.4 dùng `async/await`. Nếu đang dùng bản cũ, bạn cần sửa cách gọi hàm theo ví dụ bên dưới. Muốn giữ code đồng bộ thì dùng bản [v2.1.4](https://github.com/m008v/fbchat-v2/tree/v2.1.4).
23
23
 
24
24
  > [!WARNING]
25
25
  > Đây không phải sản phẩm chính thức của Facebook. Nếu cần API chatbot chính thức, xem [Messenger Platform](https://developers.facebook.com/docs/messenger-platform/). `fbchat-v2` dùng tài khoản và cookie Facebook cá nhân, nên có rủi ro với bảo mật phiên và tài khoản. Cân nhắc trước khi sử dụng.
@@ -31,6 +31,10 @@ Mình là MinhHuyDev (`m008v`), tác giả và người duy trì dự án.
31
31
 
32
32
  `fbchat-v2` là thư viện Python để gửi và nhận tin nhắn Messenger bằng tài khoản Facebook cá nhân. Thư viện dùng `async/await`; E2EE chạy qua bridge Go. Codebase đã được tổ chức lại từ v2.2.0 và tiếp tục được sửa theo các lỗi người dùng báo về.
33
33
 
34
+ Từ 2.3.4, MQTT/E2EE tự nối lại khi mất mạng, phân biệt lỗi cookie và có callback
35
+ trạng thái. Xem [cách cấu hình](DOCS.md#tự-nối-lại).
36
+ E2EE cần bridge 2.3.4; wrapper không dùng binary cũ thiếu contract reconnect.
37
+
34
38
  Cảm ơn mọi người đã góp ý và báo lỗi. Đây là API không chính thức nên một số chức năng có thể hỏng khi Facebook thay đổi. Nếu gặp lỗi, mở issue trên [GitHub](https://github.com/m008v/fbchat-v2/issues) kèm cách tái hiện và log đã che thông tin nhạy cảm, hoặc nhắn mình qua [Telegram](https://t.me/MinhHuyDev).
35
39
 
36
40
  ---
@@ -177,7 +181,7 @@ fbchat-v2/
177
181
  | Thành phần | Tối thiểu | Khuyến nghị | Ghi chú |
178
182
  |---|---|---|---|
179
183
  | Python | 3.10 | 3.11 / 3.12 | Bắt buộc |
180
- | Go (toolchain) | 1.26.9 | 1.26.9+ | **Chỉ cần cho E2EE** - để build `fbchat-bridge-e2ee` |
184
+ | Go (toolchain) | 1.26.10 | 1.26.10+ | **Chỉ cần cho E2EE** - để build `fbchat-bridge-e2ee` |
181
185
  | Git | bất kỳ | latest | Cần cho `go mod tidy` kéo `mautrix/meta` |
182
186
  | Hệ điều hành | Windows / Linux / macOS | - | - |
183
187
  | RAM | 256 MB | 1 GB+ | Bridge E2EE chiếm ~80–150 MB khi chạy |
@@ -256,7 +260,7 @@ Nếu chỉ dùng API HTTP hoặc listener MQTT thường, bạn có thể bỏ
256
260
 
257
261
  #### 5.1. Cài Go toolchain
258
262
 
259
- - Tải về: <https://go.dev/dl/> (Go ≥ 1.26.9).
263
+ - Tải về: <https://go.dev/dl/> (Go ≥ 1.26.10).
260
264
  - Sau khi cài, mở terminal mới và kiểm tra:
261
265
 
262
266
  ```bash
@@ -300,9 +304,9 @@ Lần build đầu mất vài phút (~300 MB cache Go module). Sau đó binary k
300
304
  ```bash
301
305
  cd ..
302
306
  # Windows
303
- python scripts/smoke_bridge_rpc.py .\build\fbchat-bridge-e2ee.exe --expected-version 2.3.3
307
+ python scripts/smoke_bridge_rpc.py .\build\fbchat-bridge-e2ee.exe --expected-version 2.3.4
304
308
  # Linux/macOS
305
- python scripts/smoke_bridge_rpc.py ./build/fbchat-bridge-e2ee --expected-version 2.3.3
309
+ python scripts/smoke_bridge_rpc.py ./build/fbchat-bridge-e2ee --expected-version 2.3.4
306
310
  ```
307
311
 
308
312
  Nếu binary không nằm ở vị trí mặc định, đặt biến môi trường:
@@ -606,7 +610,7 @@ ruff check src tests scripts
606
610
  black --check src tests scripts
607
611
  mypy
608
612
  python -m build --wheel
609
- python scripts/verify_distribution.py dist/fbchat_v2-2.3.3-py3-none-any.whl
613
+ python scripts/verify_distribution.py dist/fbchat_v2-2.3.4-py3-none-any.whl
610
614
  git diff --check
611
615
  ```
612
616
 
@@ -7,7 +7,7 @@
7
7
  [![Status](https://img.shields.io/badge/status-active-22c55e)](https://github.com/m008v/fbchat-v2)
8
8
  [![PyPI](https://img.shields.io/pypi/v/fbchat-v2?color=3775A9&logo=pypi&logoColor=white)](https://pypi.org/project/fbchat-v2/)
9
9
  [![Python](https://img.shields.io/badge/Python-3.10%2B-3776AB?logo=python&logoColor=white)](https://www.python.org/)
10
- [![Version](https://img.shields.io/badge/version-2.3.3-blue)](https://github.com/m008v/fbchat-v2/releases)
10
+ [![Version](https://img.shields.io/badge/version-2.3.4-blue)](https://github.com/m008v/fbchat-v2/releases)
11
11
  [![Issues](https://img.shields.io/github/issues/m008v/fbchat-v2?color=orange)](https://github.com/m008v/fbchat-v2/issues)
12
12
  [![License](https://img.shields.io/badge/license-See%20LICENSE-lightgrey)](LICENSE)
13
13
  [![Telegram](https://img.shields.io/badge/Telegram-MinhHuyDev-26A5E4?logo=telegram&logoColor=white)](https://t.me/MinhHuyDev)
@@ -20,7 +20,7 @@
20
20
 
21
21
 
22
22
  > [!IMPORTANT]
23
- > Version 2.3.3 uses `async/await`. If you're upgrading from an older version, update your function calls using the examples below. To keep using the synchronous API, use [v2.1.4](https://github.com/m008v/fbchat-v2/tree/v2.1.4).
23
+ > Version 2.3.4 uses `async/await`. If you're upgrading from an older version, update your function calls using the examples below. To keep using the synchronous API, use [v2.1.4](https://github.com/m008v/fbchat-v2/tree/v2.1.4).
24
24
 
25
25
  > [!WARNING]
26
26
  > This is not an official Facebook product. For the official chatbot API, see [Messenger Platform](https://developers.facebook.com/docs/messenger-platform/). `fbchat-v2` uses personal Facebook accounts and session cookies, which carries risks for your session credentials and account. Consider those risks before using it.
@@ -33,6 +33,11 @@ I'm MinhHuyDev (`m008v`), the author and maintainer of this project.
33
33
 
34
34
  `fbchat-v2` is a Python library for sending and receiving Messenger messages through a personal Facebook account. It uses `async/await`, with a Go bridge for E2EE. The codebase was reorganized in v2.2.0 and has continued to receive fixes based on user reports.
35
35
 
36
+ Version 2.3.4 adds MQTT/E2EE reconnect support: network retries, separate
37
+ authentication failures, and connection-state callbacks.
38
+ See the [configuration guide](DOCS.md#tự-nối-lại).
39
+ E2EE requires the 2.3.4 bridge; the wrapper rejects older binaries without the reconnect contract.
40
+
36
41
  Thanks to everyone who has shared ideas and reported bugs. This is an unofficial API, so features can break when Facebook changes. If you run into a problem, open an issue on [GitHub](https://github.com/m008v/fbchat-v2/issues) with reproduction steps and redacted logs, or reach me on [Telegram](https://t.me/MinhHuyDev).
37
42
 
38
43
  ---
@@ -183,7 +188,7 @@ fbchat-v2/
183
188
  | Component | Minimum | Recommended | Notes |
184
189
  |---|---|---|---|
185
190
  | Python | 3.10 | 3.11 / 3.12 | Required |
186
- | Go (toolchain) | 1.26.9 | 1.26.9+ | **Only required for E2EE** - used to build `fbchat-bridge-e2ee` |
191
+ | Go (toolchain) | 1.26.10 | 1.26.10+ | **Only required for E2EE** - used to build `fbchat-bridge-e2ee` |
187
192
  | Git | any | latest | Needed for `go mod tidy` to pull `mautrix/meta` |
188
193
  | OS | Windows / Linux / macOS | - | - |
189
194
  | RAM | 256 MB | 1 GB+ | The E2EE bridge uses about 80-150 MB while running |
@@ -262,7 +267,7 @@ You can skip this step if you only use HTTP APIs or the regular MQTT listener. T
262
267
 
263
268
  #### 5.1. Install the Go toolchain
264
269
 
265
- - Download it from: <https://go.dev/dl/> (Go >= 1.26.9).
270
+ - Download it from: <https://go.dev/dl/> (Go >= 1.26.10).
266
271
  - After installation, open a new terminal and check:
267
272
 
268
273
  ```bash
@@ -306,9 +311,9 @@ The first build may take a few minutes and about 300 MB of Go module cache. Afte
306
311
  ```bash
307
312
  cd ..
308
313
  # Windows
309
- python scripts/smoke_bridge_rpc.py .\build\fbchat-bridge-e2ee.exe --expected-version 2.3.3
314
+ python scripts/smoke_bridge_rpc.py .\build\fbchat-bridge-e2ee.exe --expected-version 2.3.4
310
315
  # Linux/macOS
311
- python scripts/smoke_bridge_rpc.py ./build/fbchat-bridge-e2ee --expected-version 2.3.3
316
+ python scripts/smoke_bridge_rpc.py ./build/fbchat-bridge-e2ee --expected-version 2.3.4
312
317
  ```
313
318
 
314
319
  If the binary is not in the default location, set the environment variable:
@@ -612,7 +617,7 @@ ruff check src tests scripts
612
617
  black --check src tests scripts
613
618
  mypy
614
619
  python -m build --wheel
615
- python scripts/verify_distribution.py dist/fbchat_v2-2.3.3-py3-none-any.whl
620
+ python scripts/verify_distribution.py dist/fbchat_v2-2.3.4-py3-none-any.whl
616
621
  git diff --check
617
622
  ```
618
623
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "fbchat-v2"
7
- version = "2.3.3"
7
+ version = "2.3.4"
8
8
  description = "Async-first, account-based Python library for the unofficial Facebook Messenger API with E2EE support."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -11,6 +11,7 @@ from ._messaging import _editMessage as editMessage
11
11
  from ._messaging._bridge_actions import BridgeActions
12
12
  from ._messaging._listening import listeningEvent
13
13
  from ._messaging._listening_e2ee import listeningE2EEEvent
14
+ from ._messaging._reconnect import ConnectionFailure, ReconnectPolicy
14
15
  from ._messaging._send import api as SendAPI
15
16
  from ._messaging._send_e2ee import api as E2EESendAPI
16
17
 
@@ -27,6 +28,8 @@ __all__ = [
27
28
  "FileSessionStorage",
28
29
  "listeningEvent",
29
30
  "listeningE2EEEvent",
31
+ "ReconnectPolicy",
32
+ "ConnectionFailure",
30
33
  "BridgeActions",
31
34
  "SendAPI",
32
35
  "E2EESendAPI",
@@ -18,6 +18,6 @@ File liên quan:
18
18
  Author: @m008v (MinhHuyDev)
19
19
  """
20
20
 
21
- __version__ = "2.3.3"
21
+ __version__ = "2.3.4"
22
22
 
23
23
  __all__ = ["_session", "_utils", "_facebookLogin", "__version__"]
@@ -55,6 +55,7 @@ src/fbchat_v2/_messaging/
55
55
  ├── _attachments.py # Upload file -> attachment ID
56
56
  ├── _listening.py # MQTT listener thường
57
57
  ├── _listening_e2ee.py # Bridge process và listener E2EE
58
+ ├── _reconnect.py # Retry policy và trạng thái kết nối
58
59
  ├── _bridge_actions.py # Action async qua JSON-RPC
59
60
  ├── _send_e2ee.py # Standalone compatibility sender
60
61
  ├── _editMessage.py # Sửa tin qua LS task
@@ -87,7 +88,7 @@ Các dependency chính:
87
88
 
88
89
  ### Bridge E2EE
89
90
 
90
- `bridge-e2ee/go.mod` yêu cầu Go 1.26.9.
91
+ `bridge-e2ee/go.mod` yêu cầu Go 1.26.10.
91
92
 
92
93
  ```bash
93
94
  git submodule update --init --recursive bridge-e2ee/meta
@@ -116,6 +117,7 @@ __all__ = [
116
117
  "_listening",
117
118
  "_listening_e2ee",
118
119
  "_reactions",
120
+ "_reconnect",
119
121
  "_send",
120
122
  "_send_e2ee",
121
123
  "_unsend",
@@ -567,7 +569,13 @@ finally:
567
569
  await task
568
570
  ```
569
571
 
570
- Watchdog tự khởi chạy lại bridge tối đa 5 lần, có backoff. Ứng dụng vẫn cần theo dõi listener task và event `bridge_fatal`.
572
+ Từ 2.3.4, E2EE dùng `ReconnectPolicy` chung với MQTT: retry lỗi mạng
573
+ với backoff/jitter, mặc định không giới hạn; auth/protocol/config không retry.
574
+ Socket Go tự nối lại khi process còn khỏe. Với `e2ee_memory_only=True`, crash
575
+ process báo `device_state_lost` thay vì tự pair device mới; muốn giữ state qua
576
+ process mới, chọn `e2ee_memory_only=False` cùng `device_path` riêng.
577
+ Theo dõi `connection_status`, listener task và `bridge_fatal`; xem cấu hình
578
+ chi tiết trong [DOCS](../../DOCS.md#tự-nối-lại--source-chưa-phát-hành).
571
579
 
572
580
  ---
573
581
 
@@ -55,6 +55,7 @@ src/fbchat_v2/_messaging/
55
55
  ├── _attachments.py # File upload -> attachment ID
56
56
  ├── _listening.py # Regular MQTT listener
57
57
  ├── _listening_e2ee.py # Bridge process and E2EE listener
58
+ ├── _reconnect.py # Retry policy and connection status
58
59
  ├── _bridge_actions.py # Async JSON-RPC actions
59
60
  ├── _send_e2ee.py # Standalone compatibility sender
60
61
  ├── _editMessage.py # Edit through an LS task
@@ -87,7 +88,7 @@ Main dependencies:
87
88
 
88
89
  ### E2EE bridge
89
90
 
90
- `bridge-e2ee/go.mod` requires Go 1.26.9.
91
+ `bridge-e2ee/go.mod` requires Go 1.26.10.
91
92
 
92
93
  ```bash
93
94
  git submodule update --init --recursive bridge-e2ee/meta
@@ -116,6 +117,7 @@ __all__ = [
116
117
  "_listening",
117
118
  "_listening_e2ee",
118
119
  "_reactions",
120
+ "_reconnect",
119
121
  "_send",
120
122
  "_send_e2ee",
121
123
  "_unsend",
@@ -498,7 +500,14 @@ finally:
498
500
  await task
499
501
  ```
500
502
 
501
- The watchdog respawns a crashed bridge up to five times with backoff. The application must still monitor the listener task and `bridge_fatal` events.
503
+ Since 2.3.4, E2EE shares `ReconnectPolicy` with MQTT: network failures use
504
+ capped backoff and jitter, with unlimited retries by default. Authentication,
505
+ protocol, and configuration failures stop retrying. A healthy Go process owns
506
+ socket reconnection. With `e2ee_memory_only=True`, a process crash reports
507
+ `device_state_lost` instead of pairing a new device; use `e2ee_memory_only=False`
508
+ and a dedicated `device_path` to retain state across processes.
509
+ Monitor `connection_status`, the listener task, and `bridge_fatal`; see
510
+ [DOCS](../../DOCS.md#tự-nối-lại--source-chưa-phát-hành) for configuration.
502
511
 
503
512
  ---
504
513
 
@@ -26,6 +26,7 @@ __all__ = [
26
26
  "_listening",
27
27
  "_listening_e2ee",
28
28
  "_reactions",
29
+ "_reconnect",
29
30
  "_send",
30
31
  "_send_e2ee",
31
32
  "_unsend",
@@ -0,0 +1,11 @@
1
+ # Generated by scripts/sync_canonical_package.py; do not edit directly.
2
+ """Generated by the release workflow; do not edit in a built package."""
3
+
4
+ BRIDGE_RELEASE_VERSION: str | None = '2.3.4'
5
+ BRIDGE_SHA256: dict[str, str] = {
6
+ 'fbchat-bridge-e2ee-darwin-amd64': 'f0d7a95eddf21cf0fc96bed33275d8f25e430626f0caba736eed40ff34b98f3b',
7
+ 'fbchat-bridge-e2ee-darwin-arm64': '8eec475a33cbe3b836717e793a5d09827dd331e9b08c14b56c500ca7a4a31d10',
8
+ 'fbchat-bridge-e2ee-linux-amd64': '6de0ce8db4986da2fd471385d63b61a5334084edb78bc6de2f53ecea6500189d',
9
+ 'fbchat-bridge-e2ee-linux-arm64': '4d61087632c2c157294502265cb1e8807c0c5ac9c3d8addca2c109dd1eec1544',
10
+ 'fbchat-bridge-e2ee-windows-amd64.exe': 'dd304ef952eccfabae8c7c1f6dce71decc1ed0bf275f5aec59e155460fe235e3',
11
+ }