2019-10-16 20:03:47 +03:00
|
|
|
/*
|
2021-12-31 02:08:43 +03:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2015-03-23 23:28:42 +03:00
|
|
|
*
|
2018-02-17 05:24:55 +03: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 23:28:42 +03:00
|
|
|
*/
|
2015-03-19 19:55:40 +03:00
|
|
|
|
2016-11-23 18:47:52 +03:00
|
|
|
#import <React/RCTEventEmitter.h>
|
2015-04-21 19:48:29 +03:00
|
|
|
|
2017-07-26 18:12:12 +03:00
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
|
|
|
|
@protocol RCTWebSocketContentHandler <NSObject>
|
|
|
|
|
2018-01-26 20:06:14 +03:00
|
|
|
- (id)processWebsocketMessage:(id __nullable)message
|
|
|
|
forSocketID:(NSNumber *)socketID
|
|
|
|
withType:(NSString *__nonnull __autoreleasing *__nonnull)type;
|
2017-07-26 18:12:12 +03:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
2016-11-23 18:47:52 +03:00
|
|
|
@interface RCTWebSocketModule : RCTEventEmitter
|
2015-03-19 19:55:40 +03:00
|
|
|
|
2017-07-26 18:12:12 +03: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 19:55:40 +03:00
|
|
|
@end
|
2017-07-26 18:12:12 +03:00
|
|
|
|
|
|
|
NS_ASSUME_NONNULL_END
|