标头应用程序/流+ json奇怪的行为

这是我的PHP代码:

header('Content-Type: application/stream+json');
$array = [];
for($i = 0; $i < 10000; $i++)
    $array[] = $i;
echo json_encode($array);

Now here is the situation. There is a client that is subscribed to this stream in Java with a delay of some millis between onNext element. When the client reaches reading any number(let's say 1000), I changed the php code to for($i = 0; $i < 1000; $i++). What I expect is that the client should recieve an onError event or some problem but the client doesn't have any issues and keeps iterating till 10000 elements. Can someone shed light on what is happening here?

评论