Skip to content

Conversation

@zztkm
Copy link
Contributor

@zztkm zztkm commented Apr 9, 2025

  • [CHANGE] MediaCHannelHandlersonDisconnect: ((Error?) -> Void)?onDisconnectLegacy という名前に変更し、非推奨にする
    • onDisconnect: ((SoraCloseEvent) -> Void)? に移行するため、名前を変更した
  • [UPDATE] Sora との接続を終了した際のイベント情報を表す、SoraCloseEvent を追加する
  • [UPDATE] MediaChannelHandlersonDisconnect: ((SoraCloseEvent) -> Void)? を追加する

Copilo Summary

This pull request includes changes to the Sora project to improve the handling of disconnection events and update some deprecated methods. The most important changes include the introduction of a new SoraCloseEvent enum, deprecation of the old onDisconnect handler, and updates to the error handling logic.

Improvements to disconnection handling:

  • Sora/MediaChannel.swift: Introduced the SoraCloseEvent enum to represent disconnection events, with cases for normal disconnection (.ok) and errors (.error).
  • Sora/MediaChannel.swift: Deprecated the onDisconnect: ((Error?) -> Void)? handler and replaced it with onDisconnect: ((SoraCloseEvent) -> Void)?. Added a new onDisconnectLegacy handler for backward compatibility.
  • Sora/MediaChannel.swift: Updated the internalDisconnect method to generate SoraCloseEvent based on the error and call the appropriate disconnection handlers.

Updates to error handling:

  • Sora/SoraError.swift: Modified the webSocketClosed error to include status code 1000 and updated the documentation to reflect the changes in how disconnection reasons are handled.

Documentation updates:

  • CHANGES.md: Documented the deprecation of the old onDisconnect handler and the introduction of the new SoraCloseEvent enum and onDisconnect handler.

@zztkm zztkm self-assigned this Apr 9, 2025
@zztkm zztkm changed the title [WIP] SoraCloseEvent を追加する onDisconnect: ((SoraCloseEvent) -> Void)) を追加する Apr 9, 2025
@zztkm zztkm requested a review from Copilot April 9, 2025 09:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

Sora/MediaChannel.swift:424

  • [nitpick] Consider using a more descriptive default message instead of 'NO-ERROR' for a successful disconnect event.
return SoraCloseEvent.ok(code: 1000, reason: "NO-ERROR")

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@zztkm zztkm requested review from Copilot and miosakuma April 9, 2025 09:57
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

Sora/MediaChannel.swift:424

  • [nitpick] The literal 'NO-ERROR' may be unclear to end users. Consider using a more descriptive message to better explain the absence of an error.
return SoraCloseEvent.ok(code: 1000, reason: "NO-ERROR")

zztkm added 2 commits April 9, 2025 19:01
…ct-with-sora-close-event' into feature/on-disconnect-with-sora-close-event
Copy link
Contributor

@miosakuma miosakuma left a comment

Choose a reason for hiding this comment

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

確認しました、対応ありがとうございます。

@zztkm zztkm merged commit 6db7969 into develop Apr 10, 2025
4 checks passed
@zztkm zztkm deleted the feature/on-disconnect-with-sora-close-event branch April 10, 2025 09:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants