<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/*  Author  : Daswasn /Tanggal : 09-09-2016   
 *  Revisi  : 
 */

class Sse_server extends CI_Controller {
    public function __construct() {
        parent::__construct();  
        $this->load->model('m_menu');   
        $this->load->model('login/m_login');  
        $this->load->model('m_custom');
        $this->load->helper('message_helper');
    }   

    function checking_session(){

        /*header("Content-Type: text/event-stream");
        header("Cache-Control: no-cache");
        header("Connection: keep-alive");

        $limit      = 1000;
        $lastId     = 0;
        while($lastId < $limit){
            $is_login = $this->m_login->get_session_id($this->session->userdata('session_id'),$this->session->userdata('username'));
            if($is_login){
                $value   = "ok";
                echo "id: $lastId\n";
                echo "data: {$value}\n\n";
                ob_flush();
                flush();
                $lastId++;
                sleep(8);
            }else{
                $value   = "fail";
                echo "id: $lastId\n";
                echo "data: {$value}\n\n";
                ob_flush();
                flush();
                $lastId++;
                sleep(8);
            }
        }

        sleep(rand(1, 3));*/
    }

}