Closed arjundas closed 8 years ago
What version of Laravel are you using ?
Ah, I see from your structure it seems to be Laravel 4. can you please use the following in your composer.json
:
{
"vinelab/minion": "1.2"
}
then perform a composer update
and try again.
NO, its not work, :(,
I am using modular structure in Laravel
, Can it affect this?
I am using creolab/laravel-modules for Modularization in laravel
.
It shouldn't matter what structure you use, as long as your provider is extending Vinelab\Minion\Provider
it should work.
If you are running minion using artisan make sure you tell minion about your ChatProvider
class with the register
option:
php artisan minion:run --register="ChatProvider"
I tried this also but it still not working.
seems like Minion is detecting the wrong ChatProvider
class
@arjundas I replied to your stackoverflow. @Mulkave is right, it is detecting a different ChatProvider class. Make sure Laravel is loading providers folder or you can't just use ChatProvider directly. You need to specify proper namespacing. PSR-0 standard.
namespace Providers\ChatProvider;
then you register ChatProvider like this --register"Providers\ChatProvider"
you need to specify composer what to autoload.
Minion and Laravel are loading differently. That's why you need to specify a namespace.
Just got the same error. I am using Laravel 4. Here is my folder configuration :
app
+ Arato
+ push
- AlertProvider.php
+ commands
+ config
+ controllers
in my composer.json :
"autoload": {
"classmap": [
...
"app/Arato"
]
}
the minion.php :
<?php
return [
/*
|--------------------------------------------------------------------------
| Router Realm
|--------------------------------------------------------------------------
|
| The realm that the router should use.
|
*/
'realm' => 'minion',
/*
|--------------------------------------------------------------------------
| Router Host
|--------------------------------------------------------------------------
|
| The IP or hostname that the router should run under.
|
*/
'host' => '127.0.0.1',
/*
|--------------------------------------------------------------------------
| Router Port
|--------------------------------------------------------------------------
|
| The port that should be used by the router.
|
*/
'port' => 9090,
/*
|--------------------------------------------------------------------------
| Auto-registered Providers
|--------------------------------------------------------------------------
|
| The providers listed here will be automatically registered on the
| session start of the router, in return their role is to register RPCs,
| subscribe and publish to topics and pretty much whatever an Internal Client does.
|
*/
'providers' => [
"Arato\push\AlertProvider"
],
'debug' => true,
];
the AlertProvider.php file :
<?php
namespace Arato\push;
use Vinelab\Minion\Provider;
class AlertProvider extends Provider
{
public function boot()
{
$this->publish('i.am.here', ['name' => 'mr.minion']);
}
}
I do not know why the namespace is incorrect.
Best regards.
The problem is a namespace problem, you are classmapping in composer instead of autoloading with PSR, try:
"autoload": {
" ...",
"psr-0": {
"Arato": "app/"
}
}
And as a standard convention, try uppercasing the push
folder, namespace and provider such as:
namespace Arato\Push;
Thank you, I think it should be fixed now.
However I still have a problem, when I run php artisan minion:run
with debug to true, I get the following :
2015-03-16T21:16:44.3259470 info [Thruway\Transport\PawlTransportProvider 7393] Starting Transport
2015-03-16T21:16:44.3288680 info [Thruway\Transport\PawlTransportProvider 7393] Pawl has connected
2015-03-16T21:16:44.3311980 debug [Thruway\Transport\PawlTransportProvider 7393] Received: [2,356050420,{"roles":{"broker":{"features":{"publisher_exclusion":true,"subscriber_blackwhite_listing":true,"subscription_meta_api":true,"pattern_based_subscription":true,"publisher_identification":true}},"dealer":{"features":{"progressive_call_results":true,"shared_registration":true,"registration_meta_api":true,"pattern_based_registration":true,"caller_identification":true}}},"authid":"oJp4lmZNL5TWfnh2ADMzOO7K","authrole":"anonymous","authmethod":"anonymous"}]
2015-03-16T21:16:44.3313030 debug [Vinelab\Minion\Client 7393] Client onMessage: [Thruway\Message\WelcomeMessage]
2015-03-16T21:16:44.3313290 info [Vinelab\Minion\Client 7393] We have been welcomed...
2015-03-16T21:16:44.3327700 info [Thruway\Transport\PawlTransportProvider 7393] Pawl has closed
2015-03-16T21:16:45.8362700 info [Thruway\Transport\PawlTransportProvider 7393] Starting Transport
2015-03-16T21:16:45.8389650 info [Thruway\Transport\PawlTransportProvider 7393] Pawl has connected
2015-03-16T21:16:45.8412010 debug [Thruway\Transport\PawlTransportProvider 7393] Received: [2,1628429246,{"roles":{"broker":{"features":{"publisher_exclusion":true,"subscriber_blackwhite_listing":true,"subscription_meta_api":true,"pattern_based_subscription":true,"publisher_identification":true}},"dealer":{"features":{"progressive_call_results":true,"shared_registration":true,"registration_meta_api":true,"pattern_based_registration":true,"caller_identification":true}}},"authid":"o67hOrx3oruFbO62ecd1o567","authrole":"anonymous","authmethod":"anonymous"}]
2015-03-16T21:16:45.8413230 debug [Vinelab\Minion\Client 7393] Client onMessage: [Thruway\Message\WelcomeMessage]
2015-03-16T21:16:45.8413510 info [Vinelab\Minion\Client 7393] We have been welcomed...
2015-03-16T21:16:45.8430050 info [Thruway\Transport\PawlTransportProvider 7393] Pawl has closed
and it is looping.
EDIT : seems this behavior comes from $this->publish('i.am.here', ['name' => 'mr.minion']);
EDIT 2 :
it should be
$this->publish('i.am.here', [], ['name' => 'mr.minion']);
@prbaron exactly! It is publish($topic, $args, $kwArgs)
where $args
is an array of arguments and $kwArgs
is the key-value array. Glad you had it resolved.
I use this plugin to get notification in my
client app ( angularjs )
fromserver ( Laravel 4.2 )
, I implementautobahn.js
at client side, but when i implementVinelab/minion
library inLaravel
and trying to run minion by callingphp artisan minion:run
it give me error likedirectory structure
and in
app/config/packages/vinelab/minion/minion.php
and in
providers/ChatProvider.php
I check for various name space and lot of things but i can not solve this.
Please tell where i am wrong.
Thanks...