宽窄优行-由【嘉易行】项目成品而来
younger_times
2023-04-06 a1ae6802080a22e6e6ce6d0935e95facb1daca5c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//
//  RHSocketService.h
//  RHSocketDemo
//
//  Created by zhuruhong on 15/6/18.
//  Copyright (c) 2015年 zhuruhong. All rights reserved.
//
 
#import <Foundation/Foundation.h>
#import <RHSocketKit/RHSocketKit.h>
 
extern NSString *const kNotificationSocketServiceState;
extern NSString *const kNotificationSocketPacketRequest;
extern NSString *const kNotificationSocketPacketResponse;
 
/**
 *  封装好的单例socket服务器工具,需要初始化编码解码器codec
 */
@interface RHSocketService : RHChannelService
 
/** 数据发送时使用的编码器 */
@property (nonatomic, strong) id<RHSocketEncoderProtocol> encoder;
/** 数据接收后处理的解码器 */
@property (nonatomic, strong) id<RHSocketDecoderProtocol> decoder;
/** 心跳逻辑 */
@property (nonatomic, strong) RHChannelBeats *channelBeats;
/** 固定心跳包 (设置心跳包,在连接成功后,开启心态定时器) */
@property (nonatomic, strong) id<RHUpstreamPacket> heartbeat;
 
@property (nonatomic, strong, readonly) RHSocketConnectParam *connectParam;
 
+ (instancetype)sharedInstance;
 
- (void)startServiceWithHost:(NSString *)host port:(int)port;
- (void)startServiceWithConnectParam:(RHSocketConnectParam *)connectParam;
 
@end