提交
This commit is contained in:
64
QXLive/Manager/QXManagerMqtt.h
Executable file
64
QXLive/Manager/QXManagerMqtt.h
Executable file
@@ -0,0 +1,64 @@
|
||||
//
|
||||
// ManagerMqtt.h
|
||||
// SoundRiver
|
||||
//
|
||||
// Created by apple on 2020/3/19.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "MQTTClient.h"
|
||||
#import "MQTTSessionManager.h"
|
||||
#import <CommonCrypto/CommonHMAC.h>
|
||||
static NSString * _Nonnull qx_room_topic = @"qx_room_topic";
|
||||
static NSString * _Nonnull qx_ac_topic = @"qx_xunlehui";
|
||||
static NSString * _Nonnull qx_hour_ranking = @"qx_hour_ranking";
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@protocol MQTTClientModelDelegate <NSObject>
|
||||
@optional
|
||||
- (void)MQTTClientModel_handleMessage:(NSData *)data onTopic:(NSString *)topic retained:(BOOL)retained;
|
||||
- (void)socketManager:(NSString *)socketManager receivedMessage:(NSDictionary *)message topic:(NSString *)topic;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@interface QXManagerMqtt : NSObject
|
||||
@property (nonatomic, assign) BOOL isDiscontent;
|
||||
@property (nonatomic, weak) id <MQTTClientModelDelegate> delegate;
|
||||
|
||||
@property (nonatomic,strong,nullable) MQTTSessionManager *mySessionManager;
|
||||
|
||||
+ (instancetype)sharedInstance;
|
||||
|
||||
|
||||
- (void)bindWithUserName:(NSString *)username password:(NSString *)password cliendId:(NSString *)cliendId isSSL:(BOOL)isSSL;
|
||||
|
||||
- (void)disconnect;
|
||||
|
||||
- (void)reConnect;
|
||||
|
||||
/**
|
||||
订阅主题
|
||||
|
||||
@param topic 主题
|
||||
*/
|
||||
typedef void (^SubscribeTopicHandler)(NSString *topic, BOOL success);
|
||||
|
||||
- (void)subscribeTopic:(NSString *)topic;
|
||||
|
||||
/**
|
||||
取消订阅
|
||||
|
||||
@param topic 主题
|
||||
*/
|
||||
- (void)unsubscribeTopic:(NSString *)topic;
|
||||
|
||||
/**
|
||||
发布消息
|
||||
*/
|
||||
- (void)sendDataToTopic:(NSString *)topic dict:(NSDictionary *)dict;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
Reference in New Issue
Block a user