<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Kommentare zu: HTML5 WebSockets Example</title>
	<atom:link href="http://bohuco.net/blog/2010/07/html5-websockets-example/feed/" rel="self" type="application/rss+xml" />
	<link>http://bohuco.net/blog/2010/07/html5-websockets-example/</link>
	<description>Die Sollbruchstelle des Internets.</description>
	<lastBuildDate>Thu, 02 Feb 2012 23:15:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
	<item>
		<title>Von: Arturs Birzgals</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-390</link>
		<dc:creator>Arturs Birzgals</dc:creator>
		<pubDate>Tue, 15 Nov 2011 10:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-390</guid>
		<description>function hybi_decode($data){
    $bytes = $data;
    $data_length = &quot;&quot;;
    $mask = &quot;&quot;;
    $coded_data = &quot;&quot; ;
    $decoded_data = &quot;&quot;;
    $data_length = $bytes[1] &amp; 127;
    if($data_length === 126){
       $mask = substr($bytes, 4, 8);
       $coded_data = substr($bytes, 8);
    }else if($data_length === 127){
        $mask = substr($bytes, 10, 14);
        $coded_data = substr($bytes, 14);
    }else{
        $mask = substr($bytes, 2, 6);
        $coded_data = substr($bytes, 6);
    }
    for($i=0;$i&lt;strlen($coded_data);$i++){
        $decoded_data .= $coded_data[$i] ^ $mask[$i%4];
    }
    return $decoded_data;
}


function hybi_encode($data)
{
    $frame = Array();
    $encoded = &quot;&quot;;
    $frame[0] = 0x81;
    $data_length = strlen($data);    if($data_length &gt; 8;
        $frame[3] = $data_length &amp; 0xFF;
    }    for($i=0;$i&lt;sizeof($frame);$i++){
        $encoded .= chr($frame[$i]);
    }    $encoded .= $data;
    return $encoded;
}</description>
		<content:encoded><![CDATA[<p>function hybi_decode($data){<br />
    $bytes = $data;<br />
    $data_length = &#8220;&#8221;;<br />
    $mask = &#8220;&#8221;;<br />
    $coded_data = &#8220;&#8221; ;<br />
    $decoded_data = &#8220;&#8221;;<br />
    $data_length = $bytes[1] &amp; 127;<br />
    if($data_length === 126){<br />
       $mask = substr($bytes, 4, 8);<br />
       $coded_data = substr($bytes, 8);<br />
    }else if($data_length === 127){<br />
        $mask = substr($bytes, 10, 14);<br />
        $coded_data = substr($bytes, 14);<br />
    }else{<br />
        $mask = substr($bytes, 2, 6);<br />
        $coded_data = substr($bytes, 6);<br />
    }<br />
    for($i=0;$i&lt;strlen($coded_data);$i++){<br />
        $decoded_data .= $coded_data[$i] ^ $mask[$i%4];<br />
    }<br />
    return $decoded_data;<br />
}</p>
<p>function hybi_encode($data)<br />
{<br />
    $frame = Array();<br />
    $encoded = &quot;&quot;;<br />
    $frame[0] = 0&#215;81;<br />
    $data_length = strlen($data);    if($data_length &gt; 8;<br />
        $frame[3] = $data_length &amp; 0xFF;<br />
    }    for($i=0;$i&lt;sizeof($frame);$i++){<br />
        $encoded .= chr($frame[$i]);<br />
    }    $encoded .= $data;<br />
    return $encoded;<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Van Nuys Bail Bonds</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-388</link>
		<dc:creator>Van Nuys Bail Bonds</dc:creator>
		<pubDate>Sat, 12 Nov 2011 04:43:37 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-388</guid>
		<description>&lt;strong&gt;Van Nuys Bail Bonds...&lt;/strong&gt;

[...]HTML5 WebSockets Example &#171; BOHUCO.NET[...]...</description>
		<content:encoded><![CDATA[<p><strong>Van Nuys Bail Bonds&#8230;</strong></p>
<p>[...]HTML5 WebSockets Example &laquo; BOHUCO.NET[...]&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Fili Wiese</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-382</link>
		<dc:creator>Fili Wiese</dc:creator>
		<pubDate>Tue, 01 Nov 2011 14:20:00 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-382</guid>
		<description>Could you please update the code to support the new hybi-10 draft?</description>
		<content:encoded><![CDATA[<p>Could you please update the code to support the new hybi-10 draft?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Digitalpassion</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-381</link>
		<dc:creator>Digitalpassion</dc:creator>
		<pubDate>Fri, 14 Oct 2011 08:02:00 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-381</guid>
		<description>How much better is this than Ajax JSON callbacks?</description>
		<content:encoded><![CDATA[<p>How much better is this than Ajax JSON callbacks?</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Sanjeev</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-361</link>
		<dc:creator>Sanjeev</dc:creator>
		<pubDate>Wed, 25 May 2011 11:18:38 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-361</guid>
		<description>I got &#039;StartListening: Unable to bind socket - Address already in use.&#039; error when php -q server.php command execute in terminal.So web socket is not working.

Please give me direction how can i test web socket properly working or not.


Thank You</description>
		<content:encoded><![CDATA[<p>I got &#8216;StartListening: Unable to bind socket &#8211; Address already in use.&#8217; error when php -q server.php command execute in terminal.So web socket is not working.</p>
<p>Please give me direction how can i test web socket properly working or not.</p>
<p>Thank You</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: elennaro</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-350</link>
		<dc:creator>elennaro</dc:creator>
		<pubDate>Sat, 09 Apr 2011 20:42:34 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-350</guid>
		<description>now who can help me with wss?
i mean SSL for web stocket workaround.</description>
		<content:encoded><![CDATA[<p>now who can help me with wss?<br />
i mean SSL for web stocket workaround.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: elennaro</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-349</link>
		<dc:creator>elennaro</dc:creator>
		<pubDate>Sat, 09 Apr 2011 20:39:39 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-349</guid>
		<description>Fixed memory leak on message quantity:

Class WebsocketChatMessage {

    ....
// Added destructor
    public function __destruct() {
        echo &quot;menya stiraut &quot; . $this-&gt;text . &quot;\n&quot;;
        unset($this-&gt;text);
        unset($this-&gt;username);
        unset($this-&gt;timestamp);
    }
// End of added destructor

    ....

}

and in 

Class WebsocketChat {

    ...
//added message limit
    private $maxmessage = 10;
//End of changes in variables

    ....
        if ($msg-&gt;action == &#039;chat&#039;) {
            $text = filter_var($msg-&gt;text, FILTER_SANITIZE_STRING);
            $lastMessage = new WebsocketChatMessage($user-&gt;data[&#039;username&#039;], $text . &quot; memory state &quot; . memory_get_usage(), time());

            $user-&gt;data[&#039;message&#039;][] = $this-&gt;messages[] = &amp;$lastMessage;

//Begin of cleaning Checking if messages is too much
            
            if (count($this-&gt;messages) &gt; $this-&gt;maxmessage) {
                //Cleaning old messages
                array_splice($this-&gt;messages, 0, 1);
                array_splice($user-&gt;data[&#039;message&#039;], 0, 1);
            }
//End of Cleaning
        }
    }
}

now the memory usage is clean and correct the script will live!</description>
		<content:encoded><![CDATA[<p>Fixed memory leak on message quantity:</p>
<p>Class WebsocketChatMessage {</p>
<p>    &#8230;.<br />
// Added destructor<br />
    public function __destruct() {<br />
        echo &#8220;menya stiraut &#8221; . $this-&gt;text . &#8220;\n&#8221;;<br />
        unset($this-&gt;text);<br />
        unset($this-&gt;username);<br />
        unset($this-&gt;timestamp);<br />
    }<br />
// End of added destructor</p>
<p>    &#8230;.</p>
<p>}</p>
<p>and in </p>
<p>Class WebsocketChat {</p>
<p>    &#8230;<br />
//added message limit<br />
    private $maxmessage = 10;<br />
//End of changes in variables</p>
<p>    &#8230;.<br />
        if ($msg-&gt;action == &#8216;chat&#8217;) {<br />
            $text = filter_var($msg-&gt;text, FILTER_SANITIZE_STRING);<br />
            $lastMessage = new WebsocketChatMessage($user-&gt;data['username'], $text . &#8221; memory state &#8221; . memory_get_usage(), time());</p>
<p>            $user-&gt;data['message'][] = $this-&gt;messages[] = &amp;$lastMessage;</p>
<p>//Begin of cleaning Checking if messages is too much</p>
<p>            if (count($this-&gt;messages) &gt; $this-&gt;maxmessage) {<br />
                //Cleaning old messages<br />
                array_splice($this-&gt;messages, 0, 1);<br />
                array_splice($user-&gt;data['message'], 0, 1);<br />
            }<br />
//End of Cleaning<br />
        }<br />
    }<br />
}</p>
<p>now the memory usage is clean and correct the script will live!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Javascript Client Connecting To Phpserver By Html5 Websocket</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-345</link>
		<dc:creator>Javascript Client Connecting To Phpserver By Html5 Websocket</dc:creator>
		<pubDate>Sun, 03 Apr 2011 13:10:14 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-345</guid>
		<description>[...] Example 1  o http://bohuco.net/blog/2010/07/html5-websockets-example/   Example 2  o http://mrdoob.com/blog/post/701   An drawing board based on WebSockets  o [...]</description>
		<content:encoded><![CDATA[<p>[...] Example 1  o <a href="http://bohuco.net/blog/2010/07/html5-websockets-example/" rel="nofollow">http://bohuco.net/blog/2010/07/html5-websockets-example/</a>   Example 2  o <a href="http://mrdoob.com/blog/post/701" rel="nofollow">http://mrdoob.com/blog/post/701</a>   An drawing board based on WebSockets  o [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Roy</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-252</link>
		<dc:creator>Roy</dc:creator>
		<pubDate>Wed, 16 Mar 2011 17:32:06 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-252</guid>
		<description>Sorry, but the ascii code got interpreted.
Between the first &#039;&#039; in the code, insert 
 0
without the space between, it will work, giving back your Json content.</description>
		<content:encoded><![CDATA[<p>Sorry, but the ascii code got interpreted.<br />
Between the first &#8221; in the code, insert<br />
 0<br />
without the space between, it will work, giving back your Json content.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Von: Roy</title>
		<link>http://bohuco.net/blog/2010/07/html5-websockets-example/#comment-251</link>
		<dc:creator>Roy</dc:creator>
		<pubDate>Wed, 16 Mar 2011 17:30:06 +0000</pubDate>
		<guid isPermaLink="false">http://bohuco.net/blog/?p=1445#comment-251</guid>
		<description>Found a solution: by js, just use the replace function of javascript example, assume msg is the string returned by websocket.message function

msg = $.parseJSON(msg.data.replace(&#039;&#039;, &#039;&#039;));

or, without jquery:

msg = JSON.parse(msg.data.replace(&#039;&#039;, &#039;&#039;));

Hope someone will find this helpful to someone.</description>
		<content:encoded><![CDATA[<p>Found a solution: by js, just use the replace function of javascript example, assume msg is the string returned by websocket.message function</p>
<p>msg = $.parseJSON(msg.data.replace(&#8221;, &#8221;));</p>
<p>or, without jquery:</p>
<p>msg = JSON.parse(msg.data.replace(&#8221;, &#8221;));</p>
<p>Hope someone will find this helpful to someone.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

