Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ You implement this
- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithData:(NSData *)data;

- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(nullable NSString *)reason wasClean:(BOOL)wasClean;
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(SRStatusCode)code reason:(nullable NSString *)reason wasClean:(BOOL)wasClean;

@end
```
Expand Down
4 changes: 2 additions & 2 deletions SocketRocket/SRWebSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ extern NSString *const SRHTTPResponseErrorKey;
@param code Code to close the socket with.
@param reason Reason to send to the server or `nil`.
*/
- (void)closeWithCode:(NSInteger)code reason:(nullable NSString *)reason;
- (void)closeWithCode:(SRStatusCode)code reason:(nullable NSString *)reason;

///--------------------------------------
#pragma mark Send
Expand Down Expand Up @@ -385,7 +385,7 @@ extern NSString *const SRHTTPResponseErrorKey;
@param reason Reason in a form of a String that was reported by the server or `nil`.
@param wasClean Boolean value indicating whether a socket was closed in a clean state.
*/
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(nullable NSString *)reason wasClean:(BOOL)wasClean;
- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(SRStatusCode)code reason:(nullable NSString *)reason wasClean:(BOOL)wasClean;

/**
Called on receive of a ping message from the server.
Expand Down
6 changes: 3 additions & 3 deletions SocketRocket/SRWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ @implementation SRWebSocket {
BOOL _sentClose;
BOOL _didFail;
BOOL _cleanupScheduled;
int _closeCode;
SRStatusCode _closeCode;

BOOL _isPumping;

Expand Down Expand Up @@ -512,7 +512,7 @@ - (void)close
[self closeWithCode:SRStatusCodeNormal reason:nil];
}

- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason
- (void)closeWithCode:(SRStatusCode)code reason:(NSString *)reason
{
assert(code);
__weak typeof(self) wself = self;
Expand Down Expand Up @@ -778,7 +778,7 @@ - (void)handleCloseWithData:(NSData *)data
[self assertOnWorkQueue];

if (self.readyState == SR_OPEN) {
[self closeWithCode:1000 reason:nil];
[self closeWithCode:SRStatusCodeNormal reason:nil];
}
dispatch_async(_workQueue, ^{
[self closeConnection];
Expand Down