mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Manual: Migrate from bridge.webSocketModule to RCTModuleRegistry
Summary: All NativeModules that access the _bridge from self to require the WebSocketModule NativeModule now instead get the WebSocketModule NativeModule from the _moduleRegistry. Changelog: [Internal] Reviewed By: PeteTheHeat Differential Revision: D25500433 fbshipit-source-id: 21aebc5684dd6a058de4e35b042c9fb255ffcb33
This commit is contained in:
committed by
Facebook GitHub Bot
parent
e1fea9d152
commit
c7e1355dec
@@ -156,23 +156,23 @@ RCT_EXPORT_METHOD(addNetworkingHandler)
|
||||
|
||||
RCT_EXPORT_METHOD(addWebSocketHandler:(double)socketID)
|
||||
{
|
||||
dispatch_async(_bridge.webSocketModule.methodQueue, ^{
|
||||
[self->_bridge.webSocketModule setContentHandler:self forSocketID:[NSNumber numberWithDouble:socketID]];
|
||||
dispatch_async(((RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{
|
||||
[[self->_moduleRegistry moduleForName:"WebSocketModule"] setContentHandler:self forSocketID:[NSNumber numberWithDouble:socketID]];
|
||||
});
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(removeWebSocketHandler:(double)socketID)
|
||||
{
|
||||
dispatch_async(_bridge.webSocketModule.methodQueue, ^{
|
||||
[self->_bridge.webSocketModule setContentHandler:nil forSocketID:[NSNumber numberWithDouble:socketID]];
|
||||
dispatch_async(((RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{
|
||||
[[self->_moduleRegistry moduleForName:"WebSocketModule"] setContentHandler:nil forSocketID:[NSNumber numberWithDouble:socketID]];
|
||||
});
|
||||
}
|
||||
|
||||
// @lint-ignore FBOBJCUNTYPEDCOLLECTION1
|
||||
RCT_EXPORT_METHOD(sendOverSocket:(NSDictionary *)blob socketID:(double)socketID)
|
||||
{
|
||||
dispatch_async(_bridge.webSocketModule.methodQueue, ^{
|
||||
[self->_bridge.webSocketModule sendData:[self resolve:blob] forSocketID:[NSNumber numberWithDouble:socketID]];
|
||||
dispatch_async(((RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{
|
||||
[[self->_moduleRegistry moduleForName:"WebSocketModule"] sendData:[self resolve:blob] forSocketID:[NSNumber numberWithDouble:socketID]];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user