POE::C...nection(3pm)

πŸ“¦
version 2.001 Β· 3 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

πŸ’– POE::Component::Client::MPD::Connection πŸ’–

okay so bestie, meet POE::Component::Client::MPD::Connection β€” that's the module handling the tcp connection with mpd. πŸŽ€ it's a Perl doc-page situation (User Contributed Perl Documentation, iykyk) and it's living at version 2.001. no cap. ✨


πŸ¦‹ VERSION πŸ¦‹

version 2.001


🌸 DESCRIPTION 🌸

so what does she actually do? this module will spawn a poe session that's responsible for the low-level communication with mpd. it's written as a POE::Component::Client::TCP, which is out here taking care of everything needed. πŸ’…

lowkey important: you're not supposed to use this class directly, okay? it's one of the helper classes for POE::Component::Client::MPD. she's backstage crew, not the main character. periodt.

πŸ‘‘ ATTRIBUTES πŸ‘‘

✨ host ✨

the hostname of the mpd server. mandatory, no default. like, she needs it. 🫢

✨ port ✨

the port of the mpd server. mandatory, no default. also non-negotiable fr fr.

✨ id ✨

the POE session id of the peer to dialog with. mandatory, no default. πŸ¦‹

✨ max_retries ✨

how much time to attempt reconnection before giving up. defaults to 5. πŸ•”

✨ retry_wait ✨

how much time to wait (in seconds) before attempting socket reconnection. defaults to 2. ⏳


πŸ’… METHODS πŸ’…

🌈 my $id = POE::Component::Client::MPD::Connection->spawn( \%params ); 🌈

this method will create a POE::Component::Client::TCP session responsible for low-level communication with mpd. πŸ’–

it will return the poe id of the session newly created. slay.


πŸ’Œ PUBLIC EVENTS ACCEPTED πŸ’Œ

disconnect( )

request the pococm-connection to be shutdown. this does not shut down the MPD server, bestie β€” just the connection. no argument. πŸ’€

send( $message )

request pococm-conn to send the $message over the wires. πŸ“‘

heads up though: this request is a POE::Component::Client::MPD::Message object properly filled up, and the _commands() attribute should not be newline terminated. don't add one, she'll be mad. πŸ™ˆ


πŸ”₯ PUBLIC EVENTS FIRED πŸ”₯

the following events are fired from the spawned session. πŸŽ†

⭐ mpd_connected( $version ) ⭐

fired when the session is connected to a mpd server. and no, this event isn't fired when the socket connection takes place β€” it's fired when the session has checked that the remote peer is a real mpd server. πŸ‘‘ $version is the advertised mpd server version. vibe check passed. βœ…

πŸ’€ mpd_connect_error_fatal( $errstr ) πŸ’€

fired when the session encounters a fatal error. this happens either when the session is connected to a server which happens to be something else than a mpd server 😭, or if there was more than "max_retries" (see spawn() params) connection retries in a row. $errstr will contain the problem encountered. no retries will be done. it's over. πŸͺ¦

🩹 mpd_connect_error_retriable( $errstr ) 🩹

fired when the session has troubles connecting to the server. $errstr will point to the faulty syscall that failed. re-connection will be tried after $retry_wait seconds (see spawn() params). we try again, bestie. 🫢

πŸ“¬ mpd_data( $msg ) πŸ“¬

fired when $msg has been sent over the wires, and the mpd server has answered with success. ✨ the actual output should be looked up in "$msg-"_data>. 🌸

πŸ”Œ mpd_disconnected( ) πŸ”Œ

fired when the socket has been disconnected for whatever reason. note that this event is not fired in the case of a programmed shutdown (see disconnect() event above). a reconnection will be automatically re-tried after $retry_wait (see spawn() params). she always comes back. πŸ’…

⚠️ mpd_error( $msg, $errstr ) ⚠️

fired when $msg has been sent over the wires, and the mpd server has answered with the error message $errstr. not the vibe, but we move. 😀


πŸŽ€ AUTHOR πŸŽ€

Jerome Quelin


this software is copyright (c) 2007 by Jerome Quelin.

this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. 🫢


aaaaand that's the whole page, bestie! πŸ¦‹ this lil masterpiece is documented for perl v5.40.1, dated 2025-04-11. go forth and talk to your mpd server, iconic behavior only. πŸ’…βœ¨πŸ’–

πŸ“¦ where this page comes from