public function onFrame($data, $type)
{
foreach (explode("\n", $data) as $pct) {
if ($pct === '') {
continue;
}
$pct = json_decode($pct, true);
if (isset($pct[0])) {
foreach ($pct as $i) {
$this->onPacket(rtrim($i, "\n"), $type);
}
} else {
$this->onPacket($pct, $type);
}
}
}