'Get waiting messages
If seq is specified, it is the sequence number of the first
message you want.  This acks all previous messages.
If batch_size is specified, it is how many messages you want.'

def _exec_poll(self, session_id, seq=None, batch_size=None):

    ses = self._get_session(session_id)
    if (ses is None):
        return {'messages': [], 'failure': 'No    session'}
    r = ses.tx(self.wfile, seq, batch_size)
    if (isinstance(r, dict) and ('result' in r)):
        r['result']['session'] = ses._session_id
    return r
