'This function is what Twisted calls with POST requests coming
in from the ajax client. The requests should be tagged with
different modes depending on what needs to be done, such as
initializing or sending/receving data through the request. It
uses a long-polling mechanism to avoid sending data unless
there is actual data available.
Args:
request (Request): Incoming request.'

def render_POST(self, request):

    dmode = request.args.get('mode', [None])[0]
    if (dmode == 'init'):
        return self.mode_init(request)
    elif (dmode == 'input'):
        return self.mode_input(request)
    elif (dmode == 'receive'):
        return self.mode_receive(request)
    elif (dmode == 'close'):
        return self.mode_close(request)
    elif (dmode == 'keepalive'):
        return self.mode_keepalive(request)
    else:
        return '""'
