phergie / phergie-irc-client-react

IRC client library built on React
BSD 3-Clause "New" or "Revised" License
56 stars 26 forks source link

Add autorun argument to run #52

Closed WyriHaximus closed 8 years ago

WyriHaximus commented 8 years ago

Currently the run method will auto start the loop, this isn't ideal when running more then phergie within the event loop

elazar commented 8 years ago

Can't those things be added before the event loop, though? That's part of why the bot is structured as it is: plugins have a chance to use the event loop before the bot tells the client to run it. I'm trying to consider this change in terms of how it would work with the bot in scenarios like these.

WyriHaximus commented 8 years ago

Where this fits in for me is running more then a Phergie bot in a single event loop. In this specific case it will also run a websocket server that interacts with an UI and a phunin-node to monitor it all.

Where it doesn't necessarily make sense to do this, it does for the client. (The bot is build as a standalone app.) But the client could be used for more then a bot as it could be integrated into a bigger app like my use case. Of course I could set up everything before Phergie runs the bot but that will cause troubles when I want to integrate another package that does exactly the same. Plus it gives control over the loop out of hand.

I've set this up in such a way it doesn't alter the default client behavior.

elazar commented 8 years ago

Fair enough. This implementation makes sense to maintain BC. In the next major version, I'd probably suggest making this the default behavior and requiring the end-user to kick off the loop outside the Client class.

WyriHaximus commented 8 years ago

Cheers, and very much appreciated. I've also added a note on this to the read me.

WyriHaximus commented 8 years ago

Anything blocking this from being merged? (And preferable tagged.)

elazar commented 8 years ago

Not that I know of. Was leaving it to @svpernova09 or @rocketpastsix to merge.

WyriHaximus commented 8 years ago

Ping @svpernova09 or @rocketpastsix :)