You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'First parameter must be a valid stream resource' in /Library/WebServer/Documents/www/comm/weixin/vendor/react/stream/src/Stream.php:40 Stack trace: #0 /Library/WebServer/Documents/www/comm/weixin/modules/chart/home.php(14): React\Stream\Stream->__construct('STDOUT', Object(React\EventLoop\StreamSelectLoop)) #1 [internal function]: modules\chart\home->index() #2 /Library/WebServer/Documents/www/comm/weixin/core/router.php(414): call_user_func_array(Array, Array) #3 /Library/WebServer/Documents/www/comm/weixin/core/router.php(391): router->load_route('modules\chart\h...', 'index', Array) #4 /Library/WebServer/Documents/www/comm/weixin/core/router.php(315): router->exec() #5 /Library/WebServer/Documents/www/comm/weixin/public/index.php(50): router::run() #6 {main} thrown
code id here
namespace modules\chart;
use React\EventLoop\Factory;
use React\Socket\Server;
use React\Stream\Stream;
class home{
public function index(){
$loop = Factory::create();
$client = stream_socket_client('tcp://127.0.0.1:1337');
$conn = new Stream($client, $loop);
$conn->pipe(new Stream(STDOUT, $loop));
$conn->write("Hello World!\n");
$loop->run();
}
public function background(){
$loop = Factory::create();
$socket = new Server($loop);
$socket->on('connection', function ($conn) {
$conn->write("Hello there!\n");
$conn->write("Welcome to this amazing server!\n");
$conn->write("Here's a tip: don't say anything.\n");
$conn->on('data', function ($data) use ($conn) {
$conn->close();
});
});
$socket->listen(1337);
$loop->run();
}
}
The text was updated successfully, but these errors were encountered:
I can only assume your error log is either incomplete (error_reporting=-1 ?) or does not match with the code you've provided? Either way, the error is from the stream component and has little to do with this socket server.
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'First parameter must be a valid stream resource' in /Library/WebServer/Documents/www/comm/weixin/vendor/react/stream/src/Stream.php:40 Stack trace: #0 /Library/WebServer/Documents/www/comm/weixin/modules/chart/home.php(14): React\Stream\Stream->__construct('STDOUT', Object(React\EventLoop\StreamSelectLoop)) #1 [internal function]: modules\chart\home->index() #2 /Library/WebServer/Documents/www/comm/weixin/core/router.php(414): call_user_func_array(Array, Array) #3 /Library/WebServer/Documents/www/comm/weixin/core/router.php(391): router->load_route('modules\chart\h...', 'index', Array) #4 /Library/WebServer/Documents/www/comm/weixin/core/router.php(315): router->exec() #5 /Library/WebServer/Documents/www/comm/weixin/public/index.php(50): router::run() #6 {main} thrown
code id here
namespace modules\chart; use React\EventLoop\Factory; use React\Socket\Server; use React\Stream\Stream; class home{
}
The text was updated successfully, but these errors were encountered: