Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OnWsClose を自分自身の時にも発火するようにする #133

Merged
merged 2 commits into from
Oct 3, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/sora_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,11 @@ void SoraSignaling::Redirect(std::string url) {
}

auto on_close = [self, url](boost::system::error_code ec) {
if (!ec) {
self->SendOnWsClose(boost::beast::websocket::close_reason(
boost::beast::websocket::close_code::normal));
}
voluntas marked this conversation as resolved.
Show resolved Hide resolved

if (self->state_ != State::Redirecting) {
return;
}
Expand Down Expand Up @@ -1143,8 +1148,14 @@ void SoraSignaling::OnRead(boost::system::error_code ec,
auto it = m.as_object().find("ignore_disconnect_websocket");
if (it != m.as_object().end() && it->value().as_bool() && ws_connected_) {
RTC_LOG(LS_INFO) << "Close WebSocket for DataChannel";
ws_->Close([self = shared_from_this()](boost::system::error_code) {},
config_.websocket_close_timeout);
ws_->Close(
[self = shared_from_this()](boost::system::error_code ec) {
if (!ec) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Close でエラーが起きてもイベントを投げたほうがいいんじゃないかって気もしますけどどうなんだろう…。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

たしかに。でも、その場合はエラーが起きてることを通知に含めるのも必要かなと思いつつ 。。。
@voluntas internal_error = 1011 でも code に入れて出すことにします?別で Python SDK からログは多分出るので。reason は SELF-CLOSED のままで。

Copy link
Member

@voluntas voluntas Sep 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

エラーは 4999 入れてもらえれば。ノーマルなエラーはできるだけ使いたくないので。SDK 側のエラーは全部 4999 にしてます。

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

了解しました

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sora から以上を通知 -> 4490
クライアントから以上を通知 -> 4999

くらいでおkです。これ on_ws_close だけでなく on_disconnect でもとれるようにしたいと思ってます。(大改革中)

self->SendOnWsClose(boost::beast::websocket::close_reason(
boost::beast::websocket::close_code::normal));
}
},
config_.websocket_close_timeout);
ws_connected_ = false;

return;
Expand Down