andrewrk / mpd.js

Connect to a music player daemon server, send commands, emit events.
MIT License
89 stars 18 forks source link

Reconnect #17

Closed JustBlackBird closed 8 years ago

JustBlackBird commented 9 years ago

The can be cases when connection to MPD server is lost. I think it will be useful to have a reconnect method inside of MPD client. In this case client code can just restore the connection without creating a new instance of MPD client.

I could provide a PR with such feature if the maintainer is interested in it.

morbidick commented 9 years ago

+1

JustBlackBird commented 8 years ago

More that year passed since I opened the issue. Now I see that reconnection should not be done inside of MPD client. Such features should be implemented at higher level, for example in a kind of pool.

If someone interested, there is a Generic Pool for node.js which could be easily turned into MPD pool with reconnection and all other fancy stuff.

ozanmuyes commented 8 years ago

@JustBlackBird thanks for the solution advice, but how did you manage the generic pool to reconnect? I have followed the steps 1 and 2 on the generic-pool's README file, but right after first attempt my application terminates.

JustBlackBird commented 8 years ago

@ozanmuyes here is an example of how I use Generic Pool with MPD client.

ozanmuyes commented 8 years ago

@JustBlackBird thank you.