Files
flipper/iOS/FlipperKit/FlipperPlatformWebSocket.h
Lorenzo Blasa 89886c972b Back out "Revert D30371791"
Summary: This change reverts a revert. The change was reverted for 'unrelated' issues addressed on this diff dependencies.

Reviewed By: passy

Differential Revision: D30696113

fbshipit-source-id: 8591d6ea79999597024c316e9927a346979e5219
2021-09-13 06:15:38 -07:00

54 lines
1.7 KiB
Objective-C

/*
* Copyright (c) Facebook, Inc. and its 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