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
First of all, thanks for this great package. I've been using it recently for a home automation service and it works great.
But I've noticed a few areas which could be improved upon. I've described the issues I'm having with the current situation and provided a possible solution.
The three improvements that would make this package even better are:
I'm using your package for a home automation service which has very little resources available and I would like to increase the reconnect timeout when the client receives a closed event without an error. Because I think this usually means the device is just completely off and there's no need to check it every second.
Because the home automation service I'm using sends me the console output any time something fails it would be a huge improvement if I only get the logs which I choose to output instead of all the debug messages which are outputted to the console by this package.
Suggestion
Refactor all console.info, console.debug, console.error, etc, calls to emitting an event. I think most classes already extend the EventEmitter so you could very easily refactor the current situation:
The home automation service I use keeps track of if a device is available or not. There is currently no nice way for me to update this state from the events the AndroidRemote emits because it doesn't emit an event for if the connection was closed.
This would be very useful because with this event I'd be able to tell if the device is available or not. At the moment I always need to assume that the device isn't available and then update it's state to available when the AndroidRemote emits a ready event.
But there's currently no way for me to change the device's state to unavailable if the RemoteManager loses connection to the TV and starts trying to reconnect to it.
Suggestion
If you could make the close event in the RemoteManager bubble up to so the AndroidRemote emits the same event that would be a huge help!
Description
First of all, thanks for this great package. I've been using it recently for a home automation service and it works great.
But I've noticed a few areas which could be improved upon. I've described the issues I'm having with the current situation and provided a possible solution.
The three improvements that would make this package even better are:
AndroidRemote
emit the connectionclose
event1. Configurable timeout
I'm using your package for a home automation service which has very little resources available and I would like to increase the reconnect timeout when the client receives a
closed
event without an error. Because I think this usually means the device is just completely off and there's no need to check it every second.Suggestion
For example add a default timeout:
That's used in the
on('close')
event:2. Refactor console logs
Because the home automation service I'm using sends me the console output any time something fails it would be a huge improvement if I only get the logs which I choose to output instead of all the debug messages which are outputted to the console by this package.
Suggestion
Refactor all
console.info
,console.debug
,console.error
, etc, calls to emitting an event. I think most classes already extend theEventEmitter
so you could very easily refactor the current situation:To something like:
And then make these events bubble up.
Then if you would like to keep the current behavior the only thing you would need to do is bind a listener on the client for these
log
events:3. Emit the
close
eventThe home automation service I use keeps track of if a device is available or not. There is currently no nice way for me to update this state from the events the
AndroidRemote
emits because it doesn't emit an event for if the connection was closed.This would be very useful because with this event I'd be able to tell if the device is available or not. At the moment I always need to assume that the device isn't available and then update it's state to available when the
AndroidRemote
emits aready
event.But there's currently no way for me to change the device's state to unavailable if the
RemoteManager
loses connection to the TV and starts trying to reconnect to it.Suggestion
If you could make the
close
event in theRemoteManager
bubble up to so theAndroidRemote
emits the same event that would be a huge help!Let me know if there's anything I can do to help!
The text was updated successfully, but these errors were encountered: