Skip to content

Commit

Permalink
refactor/#110 :: SignalingServiceDelegate 사용하던 코드 제거
Browse files Browse the repository at this point in the history
Co-Authored-By: Kiyoung <[email protected]>
  • Loading branch information
youn9k and Kiyoung-Kim-57 committed Nov 27, 2024
1 parent 1aab33a commit 3dbe4aa
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import WebRTC
import PhotoGetherNetwork

public protocol SignalingService: WebSocketClientDelegate {
@available(*, deprecated, message: "Delegate 처단.")
var delegate: SignalingServiceDelegate? { get set }

var didConnectPublisher: AnyPublisher<Void, Never> { get }
var didDidDisconnectPublisher: AnyPublisher<Void, Never> { get }
var didReceiveRemoteSdpPublisher: AnyPublisher<RTCSessionDescription, Never> { get }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ final public class SignalingServiceImpl: SignalingService {
private let decoder = JSONDecoder()
private let encoder = JSONEncoder()
private var webSocketClient: WebSocketClient
public var delegate: SignalingServiceDelegate?

private let didConnectSubject = PassthroughSubject<Void, Never>()
private let didDisconnectSubject = PassthroughSubject<Void, Never>()
Expand Down Expand Up @@ -79,12 +78,10 @@ final public class SignalingServiceImpl: SignalingService {
extension SignalingServiceImpl {
public func webSocketDidConnect(_ webSocket: WebSocketClient) {
self.didConnectSubject.send(())
self.delegate?.signalingServiceDidConnect(self)
}

public func webSocketDidDisconnect(_ webSocket: WebSocketClient) {
self.didDisconnectSubject.send(())
self.delegate?.signalingServiceDidDisconnect(self)

DispatchQueue.global().asyncAfter(deadline: .now() + 2) {
PTGDataLogger.log("Signaling server 재연결 시도 중...")
Expand All @@ -106,28 +103,22 @@ extension SignalingServiceImpl {
PTGDataLogger.log("IceCandidate decoding에 실패하였습니다.: \(response)")
return
}
PTGDataLogger.log("iceCandidate 응답 수신.\(String(describing: self.delegate))")
self.didReceiveCandidateSubject.send(iceCandidate.rtcIceCandidate)
self.delegate?.signalingService(self, didReceiveCandidate: iceCandidate.rtcIceCandidate)
case .offerSDP:
guard let sdp = response.message?.toDTO(type: SessionDescriptionMessage.self, decoder: decoder)
else {
PTGDataLogger.log("SDP decoding에 실패하였습니다.: \(response)")
return
}
PTGDataLogger.log("offerSDP 응답 수신.\(String(describing: self.delegate))")
self.didReceiveRemoteSdpSubject.send(sdp.rtcSessionDescription)
self.delegate?.signalingService(self, didReceiveRemoteSdp: sdp.rtcSessionDescription)

case .answerSDP:
guard let sdp = response.message?.toDTO(type: SessionDescriptionMessage.self, decoder: decoder)
else {
PTGDataLogger.log("SDP decoding에 실패하였습니다.: \(response)")
return
}
PTGDataLogger.log("answerSDP 응답 수신.\(String(describing: self.delegate))")
self.didReceiveRemoteSdpSubject.send(sdp.rtcSessionDescription)
self.delegate?.signalingService(self, didReceiveRemoteSdp: sdp.rtcSessionDescription)
@unknown default:
PTGDataLogger.log("Unknown Message Type: \(response)")
return
Expand Down

0 comments on commit 3dbe4aa

Please sign in to comment.