Files
flipper/iOS/FlipperKit/FlipperPlatformWebSocket.h
Andres Suarez 79023ee190 Update copyright headers from Facebook to Meta
Reviewed By: bhamodi

Differential Revision: D33331422

fbshipit-source-id: 016e8dcc0c0c7f1fc353a348b54fda0d5e2ddc01
2021-12-27 14:31:45 -08:00

54 lines
1.7 KiB
Objective-C

/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#ifdef FB_SONARKIT_ENABLED
#import <Flipper/FlipperTransportTypes.h>
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// Defines a WebSocket transport to be used by Flipper. It just acts as a
/// wrapper on top of a WebSocket connection mainly used to abstract the actual
/// used implementation.
@interface FlipperPlatformWebSocket : NSObject
/// An event handler used to dispatch socket events to the caller.
@property(nonatomic) facebook::flipper::SocketEventHandler eventHandler;
/// A message handler used to dispatch messages received from the server.
@property(nonatomic) facebook::flipper::SocketMessageHandler messageHandler;
/// A certificate provider used to obtain the client certificate used for
/// authentication.
@property(nonatomic)
facebook::flipper::SocketCertificateProvider certificateProvider;
/// Initializes an instance of FliperWebSocketTransport with an endpoint URL.
/// @param url Endpoint URL used to establish the connection.
- (instancetype)initWithURL:(NSURL* _Nonnull)url;
/// Connect to the endpoint.
- (void)connect;
/// Disconnects from the endpoint.
- (void)disconnect;
/// Send a message to the endpoint.
/// @param message The message as text to be sent to the endpoint.
/// @param error A pointer to variable for an `NSError` object.
/// If an error occurs, the pointer is set to an `NSError` object containing
/// information about the error. You may specify `nil` to ignore the error
/// information.
- (void)send:(NSString*)message error:(NSError**)error;
@end
NS_ASSUME_NONNULL_END
#endif