New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Would you tell me How to use controller send websocket MSG #464
Comments
could i have some method like swoole websocktet can be use Curl post data to "onRequest" ? |
Hi! I think you need to use other events, like: onStart, onOpen, etc. Please, take a look at: https://github.com/swooletw/laravel-swoole/wiki/7.-Websocket and https://www.swoole.co.uk/docs/modules/swoole-websocket-server |
The first is Thank for you answer my question. if use events,the first is get MSG to do ->controller->function,that is contrary. |
The document is very clear. see here eg: // routes/web.php
use SwooleTW\Http\Websocket\Facades\Websocket;
Route::get('test', function(){
$userId = Websocket::getUserId();
Websocket::toUserId($userId)->emit('message', 'hi there');
}); |
I try it, Laravel8 show me some error: config/app.php have add "SwooleTW\Http\LaravelServiceProvider::class," i found querstion from: #415 I also try make a controller files emit('message', 'hi there'); } } still show error : Illuminate\Contracts\Container\BindingResolutionException Target class [swoole.websocket] does not exist. webscket.php is run allright , client connect also ok, just routes can't run Illuminate\Contracts\Container\BindingResolutionException ? looke like Providers register have some wrong ? |
i found some info TypeError public function getUserId() |
Have you resolved this issue? I met the same. |
Make sure you read Issues Guideline and answer these questions before submitting your issue. Thanks!
(Any non-English issues will be closed immediately.)
Please provide your PHP and Swoole version. (
php -v
andphp --ri swoole
)PHP 7.3.25
Swoole => enabled
Version => 4.4.23
Please provide your Laravel/Lumen version.
Laravel8.x
Which release version of this package are you using?
I think is fix ok
What did you do? If possible, provide a recipe for reproducing the error.
i don't konw how to use controller@method to make websocket send MSG
The text was updated successfully, but these errors were encountered: