mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-20 16:04:32 +08:00
Add support for sending binary data in websockets
Summary:This is a reprise of #6327, but with iOS 7.0 compatibility and less `package.json` changes. **Test Plan:** Load WebSocketExample in UIExplorer app and start websocket test server script (both provided in #6889) and test sending binary data on both iOS and Android Closes https://github.com/facebook/react-native/pull/6961 Differential Revision: D3202022 Pulled By: mkonicek fb-gh-sync-id: 38843d0a9c0172971c5c70a5139ded04042b280a fbshipit-source-id: 38843d0a9c0172971c5c70a5139ded04042b280a
This commit is contained in:
committed by
Facebook Github Bot 8
parent
ad15b74aae
commit
ed930b4710
@@ -67,6 +67,12 @@ RCT_EXPORT_METHOD(send:(NSString *)message socketID:(nonnull NSNumber *)socketID
|
||||
[_sockets[socketID] send:message];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(sendBinary:(NSString *)base64String socketID:(nonnull NSNumber *)socketID)
|
||||
{
|
||||
NSData *message = [[NSData alloc] initWithBase64EncodedString:base64String options:0];
|
||||
[_sockets[socketID] send:message];
|
||||
}
|
||||
|
||||
RCT_EXPORT_METHOD(close:(nonnull NSNumber *)socketID)
|
||||
{
|
||||
[_sockets[socketID] close];
|
||||
|
||||
Reference in New Issue
Block a user