YH_SocketService.h 2.11 KB
//
//  YH_SocketService.h
//  Yoho
//
//  Created by Arthur on 16/6/16.
//  Copyright © 2016年 YOHO. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "YH_BarrageViewController.h"
//#import "M16HttpClient.h"
#import "YHL_Enums.h"


@protocol YH_SocketServiceDelegate <NSObject>

@optional
- (void)userPraised:(NSString *)currentTotalNum isSelfPraise:(BOOL)isSelf; //服务器通知点赞
- (void)currentPeopleNumber:(NSString *)peopleNumber;//服务器通知当前在线人数
- (void)livePalyEnd:(NSString *)audienceNums likeNums:(NSString *)likeNums videoLen:(NSString *)videoLen;//服务器通知结束播放
- (void)liveOnlineNums:(NSString *)onlineNums likes:(NSString *)likes;//服务器通知点赞数和在线人数
- (void)liveNotifyEndSuccess;//服务器告知推流发起结束成功
- (void)liveSocketServiceDidReceiveProductSkn:(NSString *)sknString;//客户端展示收到推送商品
- (void)liveSocketServiceDidReceiveShouldRefreshSknList;//客户端 刷新商品列表
- (void)liveSocketServiceDidReceiveShouldRefreshCoupon;//客户端 刷新优惠券数据
- (void)liveSocketServiceDidReceiveRedPacketWithCouponId:(NSInteger)couponId;//客户端收到红包。

@end

@interface YH_SocketService : NSObject

@property (nonatomic, strong)  YH_BarrageViewController *barrageViewController;

@property (nonatomic, strong) NSString *uid;
@property (nonatomic, strong) NSString *userName;
@property (nonatomic, strong) NSString *avartar;
@property (nonatomic, strong) NSString *room;
@property (nonatomic, strong) NSString *socketLiveHost;
@property (nonatomic, assign) NSInteger socketLivePort;
@property (nonatomic, weak) id<YH_SocketServiceDelegate> delegate;
@property (nonatomic, strong) NSArray *addressList;


- (BOOL)connect;

- (BOOL)writeDataWithParams:(NSDictionary *)params tag:(long)tag;

//登录
- (void)loginToServer;
//发消息
- (void)sendMessage:(NSString *)msg;
//用户点赞
- (void)userPraise;
//结束播放 //只有推流能调用
- (void)endPaly:(NSString *)videoLen;
//登出
-(void)logout;
//去购买的路上.
- (void)sendBuyingRoad;
//手动释放timer
//- (void)reset;

- (void)reConnect;


@end