react-native/Libraries/WebSocket
Philipp von Weitershausen 66158ab2bf Make the RCTSRWebSocketDelegate protocol part of RCTWebSocketModule public
Summary:
This allows consumers to subclass and extend `RCTWebSocketModule` and make use of the `RCTSRWebSocketDelegate` methods.

The use case here is to do some pre-processing of WebSocket data before handing it off to JS. Consumers could that in the following way:

```

interface MyWebSocketModule : RCTWebSocketModule
end

implementation MyWebSocketModule

// Don't use RCT_EXPORT_MODULE macro for this so we replace the existing RCTWebSocketModule.
+ (NSString *)moduleName { return @"RCTWebSocketModule"; }

RCT_EXTERN_METHOD(connect:(NSURL *)URL socketID:(nonnull NSNumber *)socketID)
RCT_EXTERN_METHOD(send:(NSString *)message socketID:(nonnull NSNumber *)socketID)
RCT_EXTERN_METHOD(close:(nonnull NSNumber *)socketID)

- (void)webSocket:(RCTSRWebSocket *)webSocket didReceiveMessage:(id)message
{
  [super webSocket:webSocket didReceiveMessage:[DoSomethingWith message]];
}

end
```

... and then returning a `MyWebSocketModule` ins
Closes https://github.com/facebook/react-native/pull/5321

Reviewed By: svcscm

Differential Revision: D2832374

Pulled By: nicklockwood

fb-gh-sync-id: f208516b2b2f76276223ffc972871d96afe87e27
2016-01-14 16:13:33 -08:00
..
RCTWebSocket.xcodeproj Implement WebSocket module for Android. Fixes #2837 2015-10-07 08:36:22 -07:00
__mocks__ Fix tests related to event-target-shim 2015-10-02 12:36:23 -07:00
__tests__ Fixes #3846 2015-11-06 11:24:29 -08:00
RCTSRWebSocket.h Added lightweight generic annotations 2015-11-03 14:49:30 -08:00
RCTSRWebSocket.m Replaced RCTSparseArray with NSDictionary 2015-11-14 10:28:28 -08:00
RCTWebSocketExecutor.h Refactored module access to allow for lazy loading 2015-11-25 04:49:45 -08:00
RCTWebSocketExecutor.m Improve error wording when fail to launch debugger 2016-01-14 10:02:34 -08:00
RCTWebSocketModule.h Make the RCTSRWebSocketDelegate protocol part of RCTWebSocketModule public 2016-01-14 16:13:33 -08:00
RCTWebSocketModule.m Make the RCTSRWebSocketDelegate protocol part of RCTWebSocketModule public 2016-01-14 16:13:33 -08:00
WebSocket.js Add support for binary type data (ArrayBuffer) 2015-12-23 10:07:37 -08:00
WebSocketBase.js Fixes #3846 2015-11-06 11:24:29 -08:00
WebSocketEvent.js Implement WebSocket module for Android. Fixes #2837 2015-10-07 08:36:22 -07:00