This wiki article has not been tagged with a corresponding Yii version yet.
Help us improve the wiki by updating the version information.
This is not actually Yii involved.
In this SSE wiki. This was really good. But there was few bugs. Someone might can't figure out what is it. After long long reading on SSE and yii controller I got it working.
Here are few tips before writing. Always try to use " " for echo or print. SSE recognizes server response end line by "\n", and for PHP echo '\n'; and echo "\n"; are two different meaning. "\n" = line break, '\n' echoes '\n' string. After every data or command always end line with "\n".
configuring server response time...
echo "reply: 2000 \n";
response data ...
echo "data: Hello World \n";
Remember! response data behind "data:" must be in 1 line or row. For example: echo 'data: '.$this->renderpartial('_view',array('data'=>$data),true);
In this case, in [_view] file html tags MUST be stacked and no whitespace allowed.
After all data sent, we must send end of the response kinda thing. Which is echo "\n\n"; or else no response will be shown on browser. If anything you needed more, ask free and don't hesitate.