Skip to content

Commit 6500cf8

Browse files
Update WatchLiveStream.js
1 parent 62429d9 commit 6500cf8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pages/WatchLiveStream.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ const WatchLiveStream = () => {
6666

6767
useEffect(() => {
6868
checkStreamStatus(); // Kiểm tra trạng thái khi tải trang
69-
fetchChatMessages(); // Lấy tin nhắn khi tải trang
69+
const interval = setInterval(() => {
70+
fetchChatMessages();
71+
}, 2000); // Fetch mỗi 5 giây
72+
73+
return () => clearInterval(interval); // Dọn dẹp khi component bị hủy
7074
}, [streamUrl]);
7175
const username = localStorage.getItem("userName");
7276
// Xử lý gửi tin nhắn

0 commit comments

Comments
 (0)