facebookincubator / SocketRocket

A conforming Objective-C WebSocket client library.
Other
9.54k stars 2.01k forks source link

SRStatusCode 4001 use by applications not callback to application #577

Open chenxm2 opened 6 years ago

chenxm2 commented 6 years ago

My Server close the socket with code 4001. Then I receive it on - (void)handleCloseWithData:(NSData *)data function。But, I get the code SRStatusCodeGoingAway 1001。 And I found that (dispatch_data_get_size(_outputBuffer) - _outputBufferOffset) != 0 in the Call stack handleCloseWithData->closeConnection->_pumpWriting。Then the real _closeCode 4001 missed。 How can I fix this。

tantan39 commented 5 years ago

i get the same problem too. Who can give me a solution.

YuryBogdanov commented 5 years ago

Got the same problem. I'm attempting to close socket with code 3501 (using method -(void)closeWithCode:reason:), but I got a 1005 code instead in - (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(nullable NSString *)reason wasClean:(BOOL)wasClean;.

Why the code we pass is getting lost during the closing?

tantan39 commented 5 years ago

I found the reason is my server.