NAME
Net::BEEP::Lite::ServerSession
SYNOPSIS
my $s_session = Net::BEEP::Lite::Session( Socket => $sock
AllowMultipleChannels => 1 );
$s_session->add_local_profile($my_profile);
$s_session->process_messages();
DESCRIPTION
This is the session subclass that handles the pure "server" case. This models the case of a process of fetching messages from the internal socket, and handing those messages to the profile implementation associated with the channel on which the message was received. That is, it only reacts to messages appearing on the socket.
Note that at the moment, handling multiple channels is very weak, so is it not recommended that you use that feature.
CONSTRUCTOR
This is the main constructor. It accepts a named parameter list. In addition to the parameters accepted by the superclass (Net::BEEP::Lite::Session
), the same parameters as the initialize
method.
This constructor will attempt to establish a valid BEEP session (i.e., it will send and process the greeting message.) if it is passed an actual socket in the constructor. If not (or if NoGreeting is set to true), it is up to the calling code to send the greeting.
METHODS
- initialize( ARGS )
-
This will initialize the internal state of this object. This is normally called by the constructor. It accepts a named parameter list with the following parameters:
Profiles -- a list (or scalar) of profile implementations to advertise and support.
- process_message()
-
Pull a single message from the internal socket (this will block if there is nothing to read), and hand it off to the apropriate profile implementation.
Note: this relies on the
recv_message
method, and thus doesn't handle multiple channels. This method may go away in future versions. - process_message()
-
Process messages until the session closes. This the the main routine for server sessions.
- reply_message( ARGS )
-
This is a convenience methods for profiles to create responses to received messages. It takes the same named parameters as the
Net::BEEP::Lite::Message
constructor, with the addition of "Message", containing a reference to another message object. At minimum, the "Message" and "Payload" parameters should be set.