Skip to content

Commit

Permalink
Merge pull request #9 from tsomeq/patch-1
Browse files Browse the repository at this point in the history
Update class.websocket_client.php
  • Loading branch information
nekudo committed Mar 28, 2015
2 parents ff8250a + 076fe79 commit c953361
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions client/lib/class.websocket_client.php
Expand Up @@ -30,9 +30,14 @@ public function sendData($data, $type = 'text', $masked = true)
{
if($this->_connected === false)
{
trigger_error("Not connected", E_USER_WARNING);
return false;
}
if(empty($data))
if( !is_string($data)) {
trigger_error("Not a string data was given.", E_USER_WARNING);
return false;
}
if (strlen($data) == 0)
{
return false;
}
Expand All @@ -44,7 +49,7 @@ public function sendData($data, $type = 'text', $masked = true)
$buffer = ' ';
while($buffer !== '')
{
$buffer = fread($this->_Socket, 512);
$buffer = fread($this->_Socket, 512);// drop?
}

return true;
Expand Down Expand Up @@ -324,4 +329,4 @@ private function _hybi10Decode($data)

return $decodedData;
}
}
}

0 comments on commit c953361

Please sign in to comment.