More on SSE and Yii

2 followers

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.

Total 3 comments

#15074 report it
Firebreaker at 2013/10/05 01:07am
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.

#13651 report it
Firebreaker at 2013/06/14 04:38am
@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 :).

#13620 report it
trond at 2013/06/12 02:35am
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.

Leave a comment

Please to leave your comment.