gotzmann / comet

Modern PHP framework for building blazing fast REST APIs and microservices

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with example controller

joecoolio opened this issue · comments

There is another closed issue on this but I think I see the same thing:

Using SimpleController.php exactly as in the readme, I get this on the GET request:
GET http://10.1.2.23:8080/api/v1/counter
Returns 500
Log from the web server says:

[ERR] /home/wordgame/webtest/vendor/gotzmann/comet/src/Stream.php:250 >> fwrite(): Argument #2 ($data) must be of type string, int given

I'm not sure exactly what I'm supposed to do with that.

Using the earlier example this doesn't happen. Also, the POST from the controller works fine too.
$app->get('/json',
function ($request, $response) {
$data = [ "message" => "Hello, Comet!" ];
return $response
->with($data);
}); ----works

I think I figured it out 5 minutes after posting this:
$response->getBody()->write(**(string)**self::$counter);
Write needs a string, not an integer.