Skip to content

Commit

Permalink
Expose didCloseWithCode in RCTReconnectingWebSocket
Browse files Browse the repository at this point in the history
Summary: Expose didCloseWithCode in RCTReconnectingWebSocket in order to get notified when the reconnecting websocket is closed by the end-point.

Reviewed By: javache

Differential Revision: D5573394

fbshipit-source-id: 78bffeb98c6bf32b059194fc07ffc1f0a7bf4aae
  • Loading branch information
cpluss authored and facebook-github-bot committed Aug 7, 2017
1 parent 220034c commit 72dae51
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Libraries/WebSocket/RCTReconnectingWebSocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message;

- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;

@end

@interface RCTReconnectingWebSocket : NSObject
Expand Down
1 change: 1 addition & 0 deletions Libraries/WebSocket/RCTReconnectingWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ - (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error

- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
{
[self.delegate webSocket:webSocket didCloseWithCode:code reason:reason wasClean:wasClean];
[self reconnect];
}

Expand Down
4 changes: 4 additions & 0 deletions Libraries/WebSocket/RCTWebSocketObserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ - (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
}
}

- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
{
}

@end

#endif
4 changes: 4 additions & 0 deletions React/DevSupport/RCTPackagerConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ - (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
}
}

- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
{
}

@end

#endif

0 comments on commit 72dae51

Please sign in to comment.