Connection status Online when Websockets connection failing
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 30/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- react, typescript
- Lĩnh vực
- api, networking
Hướng nghiên cứu
Tái hiện vấn đề trong thiết lập React bằng cách chặn các yêu cầu WebSocket với bộ lọc uBlock Origin đã được ghi lại, sau đó quan sát connectionStatus$ của DirectLine cùng với activity$. Bắt đầu bằng cách lần theo vòng đời của constructor DirectLine và connectionStatus$; hoàn thành khi một kết nối wss liên tục thất bại báo cáo ConnectionStatus.FailedToConnect thay vì cuối cùng trở thành Online.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
We are using this library in our React app and I encounter this weird behaviour.
The problem
When disabled Websockets connection in Chrome browser using these steps:
- Open Chrome and install this extension
- Restart Chrome
- Go to the Extensions
- Click uBlock Origin, the dashboard window or popup should be viewed
- From the dashboard, click on Settings (cogs icon, see image above)
- In the settings go to My filters tab
- Add
||*^$websocketto 1st line of the filter editor and hit Apply changes
I can see that it successfully blocks the wss connections as I can see failed requests in my network tab. The problem is that the connection status will eventually set to ConnectionStatus.Online. I would expect that it will be ConnectionStatus.FailedToConnect as the Websockets request are failing. We need this so we can react with our UI to this scenario and also to log this to our internal logging systems. I cannot see how to do it without proper connection status information, though.
Our setup
In the React code we are just initializing my DirectLine instance in effect hook:
useEffect(() => {
if (directLineTokenData) {
const body = {
token: directLineTokenData.token || '',
conversationId: conversationId || '',
...COMMON_BOT_PROPERTIES,
};
setDirectLine(new DirectLine(body));
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [directLineTokenData]);
and in another we subscribe to the activity$ and connectionStatus$ observables:
useEffect(() => {
// eslint-disable-next-line no-console
console.log('Starting subscription to all activities');
const subscribtion = directLine?.activity$.subscribe(activity =>
// eslint-disable-next-line no-console
console.log('Received activity:', activity),
);
// eslint-disable-next-line no-console
const connectionStatusSubscription = directLine?.connectionStatus$.subscribe(
status => {
switch (status) {
case ConnectionStatus.Uninitialized:
// eslint-disable-next-line no-console
console.log('STATUS: uninitialized');
break;
case ConnectionStatus.Connecting:
// eslint-disable-next-line no-console
console.log('STATUS: connecting...');
break;
case ConnectionStatus.Online:
// eslint-disable-next-line no-console
console.log('STATUS: online');
break;
case ConnectionStatus.ExpiredToken:
// eslint-disable-next-line no-console
console.log('STATUS: expired token');
break;
case ConnectionStatus.FailedToConnect:
// eslint-disable-next-line no-console
console.log('STATUS: failed to connect');
break;
case ConnectionStatus.Ended:
// eslint-disable-next-line no-console
console.log('STATUS: ended');
break;
default:
// eslint-disable-next-line no-console
console.log('STATUS: unknown status', status);
}
},
error => {
// eslint-disable-next-line no-console
console.error('Error subscribing to connection status', error);
},
);
return () => {
console.log('Stopping subscription to all activities');
subscribtion?.unsubscribe();
connectionStatusSubscription?.unsubscribe();
};
}, [directLine]);
Observing the problem
Console logs from our React app:
From the logs we can see that there is eventually a ConnectionStatus.Online connection status change, even though failing Websockets requests. What's interesting that it sets connection status to ConnectionStatus.FailedToConnect one time (before it is set to ConnectionStatus.Online)
Any help is appreciated 🙏
- Ngôn ngữ chính
- TypeScript
- Star
- 199
- Fork
- 133
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/BotFramework-DirectLineJS
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
microsoft/BotFramework-DirectLineJS#424 · 3 bình luận ·
-
Application crashes when refresh token returns an errorCó thể làm lại được @compulim đã nhận 797 ngày trước và không có pull request nào đang mở. Đang mởbug
microsoft/BotFramework-DirectLineJS#421 · 3 bình luận · 1 người được giao ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
microsoft/BotFramework-DirectLineJS#418 · 7 bình luận · 7 reaction ·
Tất cả issue của microsoft/BotFramework-DirectLineJS
Issue tương tự
-
Mend: dependency security vulnerability untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
opensearch-project/security-dashboards-plugin#2545 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Add: Dream TR SDĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
Maintainer thường phản hồi trong vòng 1 ngày
-
doctor integrity sample scans soft-deleted pages on Postgres (batch path has no deleted_at filter)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100
SocialGouv/egapro#4672 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
area:agents area:tui bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
anthropics/claude-code#98358 ·
Maintainer thường phản hồi trong vòng 1 ngày