You are viewing revision #2 of this wiki article.
This is the latest version of this article.
You may want to see the changes made in this revision.
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.
Useful
This is useful information, but I suggest you spend a little more time explaining in greater detail. As it is written now, it is a little difficult to follow for newcomers.
@trond, Thank you for your feedback.
It was the first time I'm writing an article. I'll update it as soon as fast. Next time I'll try to implement whole technique. Thanks again :).
Update Information
Sorry guys. There have been a problem and i can't solve that. when the application language is set to UTF8 language i.e "mn". SSE can not send to browser. When I find out this solution for this bug, I'll update this as soon as possible.
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.