I am trying to send Channel API messages from a GAE python backend push queue to a client. The answer to this question says that the channel must be created within the back-end process in order to be able to send messages from the backend to the client. The answer suggests that
"You could, however, implement a servlet in your backend that calls createChannel and returns it to your frontend for inclusion in javascript that your frontend renders."
My question is: How do I get the token created by the backend in a push queue to the front end so that I can send the token to the client? I create the backend push queue using the following:
taskqueue.Task(url='/flow/', params = {'json_request': json_request}, target='flowbackend').add(queue_name='flow-queue')
and I have not been able to figure how to easily send information back to the frontend.
It's kinda weird that you want to create a channel in your backend. The most obvious way is to store it somewhere in the datastore, and have a separate URL that your HTTP client can poll to get the token.
If you can, I'd recommend creating the channel on your GAE frontend before enqueuing the task, then send the token along with the task, and embed the token in the HTTP response to the client, then both the client and the backend can communicate.