Open dodo849 opened 2 months ago
WebSocketClient | StompClient | StompProvider |
---|---|---|
socket connect에 대해 보장 | Stomp CONNECT frame에 대해 보장 |
엔드포인트 연결 |
프레임 | CONNECT | DISCONNECT | SUBSCRIBE, SEND, etc |
---|---|---|---|
동작 | Error frame + 소켓 연결 없으면 재시도 > 이후 Subscription 복구 | 재시도 X 단순 소켓 종료 및 컴플리션 초기화 | Error frame + receipt-id 확인 후 일치하는 요청에 대해서만 재시도 > 이후 Subscription 복구 |
비고 | receipt-id가 없는 Error frame은 Connect 재시도로 동작함 |
public enum InterceptorRetryType {
case retry(count: Int = 1, delay: TimeInterval = 0.0)
case doNotRetry
case doNotRetryWithError(Error)
}
전체 흐름
⚠️ 문제 1. Retrier 동작 순서
⚠️ 문제 2. Retrier 실행 횟수
상황
Alamofire동작 방식으로 바꿀 시 문제점
소켓 에러 발생시 정확한 에러 원인별로 분기가 어려움.
해결방안 1. Stomp ERROR frame일때만 retry를 시도한다. 웹소켓 에러는 Log로 표시한다.
단점: 서버에 에러명세가 명확하지 않을 경우 무한 호출 가능성 -> 단, Alamofire도 이렇게 동작함.