2015-03-23 20:28:42 +00:00
|
|
|
/**
|
2018-09-11 22:27:47 +00:00
|
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
2015-03-23 20:28:42 +00:00
|
|
|
*
|
2018-02-17 02:24:55 +00:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2015-03-23 20:28:42 +00:00
|
|
|
*/
|
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>
|
|
|
|
|
2018-01-26 17:06:14 +00:00
|
|
|
- (id)processWebsocketMessage:(id __nullable)message
|
|
|
|
forSocketID:(NSNumber *)socketID
|
|
|
|
withType:(NSString *__nonnull __autoreleasing *__nonnull)type;
|
2017-07-26 15:12:12 +00:00
|
|
|
|
|
|
|
@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
|