
#ifndef _MEDIARTMPSERVICE_H_
#define _MEDIARTMPSERVICE_H_

#include "MFSPublic.h"
#include "3rd/uvw.hpp"
#include "BaseService.h"
#include "MediaRtmpProtocol.h"

namespace mfs
{
    /**
     * 面向浏览器&手机APP 推拉流的websocket服务
     * 1、客户端建立连接，创建MediaWebSocket
     * 2、接受到客户端信息，转发给MediaWebSocket
     * 
     */ 
class MediaRtmpService:public BaseService
{
private:
    MediaRtmpService(const std::string& name, int port, std::shared_ptr<uvw::Loop> loop):BaseService(name,port,loop){}
public:
    static MediaRtmpService* Instance();
    static MediaRtmpService* SetupOnce(std::string& sername, int port, std::shared_ptr<uvw::Loop> loop);

    virtual void Init()
    {
        BaseService::Init([](std::shared_ptr<uvw::Loop> loop, std::shared_ptr<uvw::TCPHandle> client,const std::string& name){
		    return new MediaRtmpProtocol(loop, client, name);
	    });
    }
    
protected:
};

}

#endif // _MEDIARTMPSERVICE_H_