//
//  OffcnIMSocketManager.h
//  OffcnIMSDKiOS
//
//  Created by vockey on 2020/8/24.
//  Copyright © 2020 offcn. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "OffcnIMModel.h"

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, OffcnIMConnectStatus) {
    OffcnIMConnectStatusSuccess,    //连接成功
    OffcnIMConnectStatusFail,           //连接失败
    OffcnIMConnectStatusBreak,          //连接断开
    OffcnIMConnectStatusDisConnectOK,   //手动断开成功
};

//收到消息回调
typedef void(^OffcnIMConnectReceiveMessage)(OffcnIMModel *IMModel);

//连接状态回调
typedef void(^OffcnIMReceiveConnectStatus)(OffcnIMConnectStatus status,NSString *errorMessage);

@interface OffcnIMSocketManager : NSObject

@property (nonatomic, copy) NSString *msg_fromId;//发送消息的用户id

@property (nonatomic, assign) OffcnIMConnectStatus IMConnectStatus;

@property (nonatomic, copy) OffcnIMConnectReceiveMessage connectReceiveMessage;
@property (nonatomic, copy) OffcnIMReceiveConnectStatus connectStatus;

//单例
+(OffcnIMSocketManager *)defaultService;

/// 建立连接
/// @param account_id 用户ID
/// @param token 用户token
-(void)connectIMServerWithAccount_id:(NSString *)account_id token:(NSString *)token;

//断开连接
-(void)disConnectIMServer;
@end

NS_ASSUME_NONNULL_END
