Reputation: 3093
I'm new in App Engine. I want to create guess words game with App Engine. So, I need to create one instance of main channel thread that listen to answer from clients and sending response and new question every periode of time.
Illustration
(1) The server thread send message to the clients
(2) Sleep for 10 seconds.
(3) Prepare new message and back to step (1)
I don't understand how to create such thread in App Engine Backend. All I know, if I need thread, I can create it in a Backend.
I don't completely understand about explaination in Google Developer that talk about Backend. So, please help me to figure it out about its concept.
I need help. How can I create a thread in Google App Engine Backend? What files (scripts and configurations) are needed to create that project? I need a view of directory listing about it. Please give me simple example that contain one frontend and one back
Upvotes: 0
Views: 214
Reputation: 77
OK as far as I understand it...
create a file bg_worker.yaml with the normal stuff for a module plus a handler for start and a handler for stop:
application: your-app
module: bg_worker
handlers:
url: /_ah/start
script: main.startWorker
url: /_ah/stop
script: main.stopWorker
in main.startWorker start your bg thread:
_thread = BackgroundThread(target = work)
Once done you can start it by including the new yaml file in the update command,
appcfg -oauth2 update app.yaml bg-worker.yaml
Upvotes: 2