mirror of https://github.com/oxen-io/session-ios
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
Objective-C
37 lines
1.0 KiB
Objective-C
//
|
|
// Copyright (c) 2017 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import "SRWebSocket.h"
|
|
|
|
static void *SocketManagerStateObservationContext = &SocketManagerStateObservationContext;
|
|
|
|
extern NSString *const kNSNotification_SocketManagerStateDidChange;
|
|
|
|
typedef NS_ENUM(NSUInteger, SocketManagerState) {
|
|
SocketManagerStateClosed,
|
|
SocketManagerStateConnecting,
|
|
SocketManagerStateOpen,
|
|
};
|
|
|
|
@interface TSSocketManager : NSObject <SRWebSocketDelegate>
|
|
|
|
@property (nonatomic, readonly) SocketManagerState state;
|
|
|
|
+ (instancetype)sharedManager;
|
|
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
// If the app is in the foreground, we'll try to open the socket unless it's already
|
|
// open or connecting.
|
|
//
|
|
// If the app is in the background, we'll try to open the socket unless it's already
|
|
// open or connecting _and_ keep it open for at least N seconds.
|
|
// If the app is in the background and the socket is already open or connecting this
|
|
// might prolong how long we keep the socket open.
|
|
//
|
|
// This method can be called from any thread.
|
|
+ (void)requestSocketOpen;
|
|
|
|
@end
|