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

Fix close code handling in SRWebSocket #677

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
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
6 changes: 5 additions & 1 deletion SocketRocket/SRWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -1488,8 +1488,12 @@ - (void)safeHandleEvent:(NSStreamEvent)eventCode stream:(NSStream *)aStream
// If we get closed in this state it's probably not clean because we should be sending this when we send messages
[self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
if (availableMethods.didCloseWithCode) {
NSInteger closeCode = SRStatusCodeGoingAway;
if (closeCodeIsValid(self->_closeCode)) {
closeCode = self->_closeCode;
}
[delegate webSocket:self
didCloseWithCode:SRStatusCodeGoingAway
didCloseWithCode:closeCode
reason:@"Stream end encountered"
wasClean:NO];
}
Expand Down