#Events & Listeners depending on shouldDiscoverEvents()

148 messages Β· Page 1 of 1 (latest)

south mirage
#

When its set to true, like how I pasted, everything worse, when I set it to false events aren't triggering

#

I also tried doing it in boot but that currently commented out

timid roost
#

It happens locally right?

south mirage
#

what happens locally? the event?

timid roost
#

The issue

south mirage
#

yes

#

i dont have a prod server, only local

#

using sail

timid roost
#

Can you run php artisan about just want to see if it says your events are cached

#

Sail might make things weird, never used it.

south mirage
#

its been acting great thus far

#

the socialite discord event is coming through telescope randomly

#

im not sure if its my discordbot running

#

or something triggering that

#

but an event is coming through

#

but not the KrakenTrade event

#

i tried to typo the importing events/listener classes to see if an error triggers

#

but didnt

timid roost
#

Not sure I follow what you mean by the discord event, but nothing looks "wrong" to me.

south mirage
#

theres 3 events in the listen queue

#

Registered, socialite discord for oauth, and kraken trade

#

i mean 3 events in the listen array*

#

i see SocialiteWasCalled coming through on telescope

timid roost
#

Seeing an event being fired in telescope vs a listener are two different things though.

#

Those events can fire all day whether they are in your array or not.

#

But you are saying that your attached listeners are never handled unless you turn on auto discovery, which does confuse me.

south mirage
#

yeah if autodiscovery is on its all fine

#

nothing comes through on telescope

#

only the Socialite event, which was the only event in there before

timid roost
#

I do not see what telescope has to do with this

#

your listeners are either handled or they are not.

south mirage
#

isnt it a way to see things happening?

#

wouldnt events come up through there ?

#

unless i filter them out

#

i thought that was the point of telescope

#

i just saw that telescope was a way to analyze everything so i was hoping it would help me know if these things triggering

timid roost
#

This is why I am confused. Do you not have another way to test that your listeners are indeed being handled without relyong on telescope?

#

Sure, telescope shows events dispatched, and and listeners handled if any

south mirage
#

when i have autodiscovery on and they are working

#

would they show up on telescope?

timid roost
#

I've never used auto discovery

south mirage
#

cause they dont but i guess my test outside of telescope is seeing them work πŸ˜‚ but is it odd that with autodiscovery on telescope doesnt see them?

#

no one uses autodiscovery haha

#

and im stuck using it right now

#

wild haha

timid roost
#

I'd suggest testing another way to actually know your listeners are being ran or not outside of telescope

#

I mean, at the least, make a new acc and see if you get the email, or a job is on your queue?

#

Since seems you do not have tests setup for this atm.

#

Would be easier to try to validate and track down an issue, if any.

south mirage
#

i dont have to pass "handle" or anything right

#

?

#

its just the class

timid roost
#

Just the class. It is assumed to have handle as the default.

south mirage
#

im not sure how id set up a test for this to be honest

timid roost
#

Do you have any feature tests setup?

south mirage
#

negative

timid roost
#

Another time then lol.

south mirage
#

haha oof yeah its on a long list

#

i working on getting an MVP

#

then can look into hiring some friends/outside devs

timid roost
#

Given what you've presented, I can't think of why you would be experiencing an issue, if any. shrug

south mirage
#

yeah im pretty baffled

#

gonna try rebooting server

#

havent done that few days

#

the event gets triggered every few seconds so its like test data is constantly coming in

#

i see it coming through on soketi, i have a websocket feed coming in with data, so a Ratchet client listens to websocket, when data comes in it triggers the Event

#

that Event has a Listener.. seems simple, i guess ill use autodiscovery until im pushing to a prod server and see if i have diff results there

#

maybe ill pry into how autodiscovery works tomorrow

timid roost
#

Did you restart your ratchet thing?

south mirage
#

yeah

#

im sure to do that cause the problem you helped me with other day

#

BroadcastNow

#

it wouldnt show up there till after i reset that websocket which was running like 3 days

#

once i had to do that is when i saw my worker queue getting flooded

#

lol

timid roost
#

You kinda went into detail about all this stuff which is only confusing me...a listener is either bound or it is not. So something seems very off here, but I can't focus on what 😦

south mirage
#

it is only bound in autodiscovery mode

timid roost
#
class EventServiceProvider extends ServiceProvider
{
    /**
     * The event to listener mappings for the application.
     *
     * @var array<class-string, array<int, class-string>>
     */
    protected $listen = [
        Registered::class => [
            SendEmailVerificationNotification::class,
        ],
    ];
}
#

WHy not just do this

#

restart your server

south mirage
#

i just did

timid roost
#

register, and see if you get the email

south mirage
#

ok 1sec

#

mailhog caught it back when i registered before

#

so imagine it does

#

before i pinged for help i went through those classes to see if i matched them, they small files and simple so another reason i got confused

timid roost
#

What is only bound in autodiscovery then

#

As in, does the above work, with no other listeners?

#

If yes, then what listener does not work with autodiscovery off

#

Then you might have more to go off of here

south mirage
#

no email

#

i figured the socialite one had to work cause if it isnt there, i cant login via discord

timid roost
#

I honestly am not sure.

south mirage
#

Driver [discord] not supported.

#

if that socialite listener isnt there

#

is there a place where verification email is enabled as well?

#

outside of the listener?

timid roost
#

Ignore that

#

Why do you have the full class string and handle method defined like that in the first place?

#

DiscordExtendSocialite::class

south mirage
#

its how the docs said to do it

timid roost
#

My dude

#

look at the link it shows to L docs

#

L5

south mirage
#

you think socialite plugins might be conflicting?

timid roost
#

You are going off in the wrong direction too often, please stop.

south mirage
#

my b dude

timid roost
#

Try the full class import

#

DiscordExtendSocialite::class

#

I have zero clue if that has anything to do with your listeners not being bound or not, but idk what is impacting what right now.

south mirage
#

Target class [App\Providers\DiscordExtendSocialite] does not exist.

timid roost
#

But is it not vendor??

#

SocialiteProviders\Discord\DiscordExtendSocialite

#

Why you importing from app namespace

south mirage
#

ok working now

#

discord login that is

timid roost
#

Autodiscovery is off correct?

south mirage
#

yes

timid roost
#

php artisan event:list | grep Discord

#

Does the listener show when you run event list

south mirage
#

⇂ SocialiteProviders\Discord\DiscordExtendSocialite

timid roost
#

Then your $listen array is working as intended. If your listener itself is not "working" you have other issues.

south mirage
#

App\Event\Trade ............................................................

#

shows up as well

#

but it works in autodiscovery? isnt that odd? want to see the listener?

timid roost
#

I came here for a Q about $listen being ignored unless autodiscovery was on. That just is not the case.

south mirage
#

all good homie

#

thanks for your time

#

ill let you know if i solve it πŸ˜„

timid roost
#

Move writing feature tests up the list πŸ˜‰

south mirage
#

i need to really understand that, ive dabbled at reading docs on it and know its importance

#

but im confused how it will help me here too

timid roost
#

Well for one, you would sure fire know if your events are being dispatched, and if listeners are being called. Two, if your test prove as much and you see issues on your production server, then it's your environment.

south mirage
#

so the test would just fire a fake test and the system would see it coming?

timid roost
#

But the scope of what you are poking around, and talking about the ratchet server, I have no clue what all is connected to what and in what order/direction. Hence why I'd rather not dig deeper atm lol

south mirage
#

imagine there a laracast on this stuff πŸ˜„

#

its not a ratchet server

timid roost
#

Definitely on laracast, though think the test series needs a subscription

south mirage
#

its a client

#

pawl client

#

Ratchet\Pawl

#

websocket client

#

websocket client gets json data -> triggers event that echos that same json data onto local server soketi server -> that event has listeners

#

pretty basic, but yes enjoy your night man πŸ™‚ thanks for assistance again

timid roost
#

Yea, brain too fried for me tonight lol. Good luck doe πŸ™‚