Skip to content

Commit

Permalink
Expose webSocketDidOpen in RCTReconnectingWebSocket
Browse files Browse the repository at this point in the history
Summary: Expose webSocketDidOpen in RCTReconnectingWebSocket in order to get notified when the reconnecting websocket is opened to the endpoint.

Reviewed By: emilsjolander

Differential Revision: D5725547

fbshipit-source-id: e904c5a84d670ecf936993ec1739614f99fce09c
  • Loading branch information
cpluss authored and facebook-github-bot committed Aug 29, 2017
1 parent b11656a commit bf67345
Show file tree
Hide file tree
Showing 4 changed files with 15 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 @@ -15,6 +15,8 @@

@protocol RCTWebSocketProtocolDelegate

- (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket;

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

- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean;
Expand Down
5 changes: 5 additions & 0 deletions Libraries/WebSocket/RCTReconnectingWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,11 @@ - (void)reconnect
});
}

- (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket
{
[self.delegate webSocketDidOpen:webSocket];
}

- (void)webSocket:(RCTSRWebSocket *)webSocket didFailWithError:(NSError *)error
{
[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 @@ -66,6 +66,10 @@ - (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
}
}

- (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket
{
}

- (void)webSocket:(RCTSRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(NSString *)reason wasClean:(BOOL)wasClean
{
}
Expand Down
4 changes: 4 additions & 0 deletions React/DevSupport/RCTPackagerConnection.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,10 @@ - (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
}
}

- (void)webSocketDidOpen:(RCTSRWebSocket *)webSocket
{
}

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

0 comments on commit bf67345

Please sign in to comment.