Skip to content

Commit

Permalink
fix handler function response
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Apr 25, 2024
1 parent 9daef40 commit 52b43a2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,15 @@ $server->start(
function (
string $request,
string $connect
) {
): ?string
{
printf(
'connection: %s request: %s',
$connect,
$request
);

return null; // null|string response
}
);
```
Expand Down
8 changes: 8 additions & 0 deletions src/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,14 @@ public function start(
$request,
$connect
);

if ($response)
{
fwrite(
$incoming,
$response
);
}
}

fclose(
Expand Down

0 comments on commit 52b43a2

Please sign in to comment.