private function compile(Rfc6455Client $client, string $msg, int $opcode, bool $fin = true) : Promise
{
$frameInfo = ["msg" => $msg, "rsv" => 0b0, "fin" => $fin, "opcode" => $opcode];
// @TODO filter mechanism …?! (e.g. gzip)
foreach ($client->builder as $gen) {
$gen->send($frameInfo);
$gen->send(null);
$frameInfo = $gen->current();
}
return $this->write($client, $frameInfo);
}