2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-03-19 16:55:40 +00:00
|
|
|
|
2016-11-23 15:47:52 +00:00
|
|
|
#import <React/RCTEventEmitter.h>
|
2015-04-21 16:48:29 +00:00
|
|
|
|
2017-07-26 15:12:12 +00:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
@protocol RCTWebSocketContentHandler <NSObject>
|
|
|
|
|
|
|
|
- (id)processMessage:(id __nullable)message forSocketID:(NSNumber *)socketID
|
|
|
|
withType:(NSString *__nonnull __autoreleasing *__nonnull)type;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2016-11-23 15:47:52 +00:00
|
|
|
@interface RCTWebSocketModule : RCTEventEmitter
|
2015-03-19 16:55:40 +00:00
|
|
|
|
2017-07-26 15:12:12 +00:00
|
|
|
// Register a custom handler for a specific websocket. The handler will be strongly held by the WebSocketModule.
|
|
|
|
- (void)setContentHandler:(id<RCTWebSocketContentHandler> __nullable)handler forSocketID:(NSNumber *)socketID;
|
|
|
|
|
|
|
|
- (void)sendData:(NSData *)data forSocketID:(nonnull NSNumber *)socketID;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
@interface RCTBridge (RCTWebSocketModule)
|
|
|
|
|
|
|
|
- (RCTWebSocketModule *)webSocketModule;
|
|
|
|
|
2015-03-19 16:55:40 +00:00
|
|
|
@end
|
2017-07-26 15:12:12 +00:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|