Added MultiStreamChannel to handle multiple endpoints

This commit is contained in:
2018-04-16 01:54:30 +02:00
parent d6aacd841f
commit 00d2bead8e
4 changed files with 156 additions and 1 deletions

View File

@ -28,6 +28,8 @@ class StreamChannel implements ChannelInterface
}
$this->stream = $stream;
stream_set_blocking($stream, false);
}
/**
@ -49,8 +51,11 @@ class StreamChannel implements ChannelInterface
public function receive()
{
$buf = fread($this->stream, 8192);
if (!$buf) {
return false;
}
return json_decode(rtrim($buf, "\0"));
return json_decode(rtrim($buf, "\0"), true);
}
/**