Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7582333
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:24:38+00:00 2026-05-30T18:24:38+00:00

I have long programming background, but am new to Python, and am playing around

  • 0

I have long programming background, but am new to Python, and am playing around with Tornado, to prototype a certain long poll service.

What I want to achieve is that user connects to say example.com/get/1234, which is the long poll part. 1234 is the user ID. For now, it just hangs and waits for the content. Then user uses a new tab/other browser/other computer/etc and goes to url like example.com/set/1234?data=abcd, where 1234 is the user ID and data is a variable with content “abcd”. Now when this happens, the first get request should print out the data “abcd” and finish the request. User ID is used obviously to allow multiple users to use the service simultaneously. So simply put:

1) Go to example.com/get/1234 -> waiting
2) In another tab, open example.com/set/1234?data=abcd
3) Right after this request, first request prints out abcd and finishes

Below is something I’ve been trying, but I’m not really advancing with this, nor cannot find proper Google keywords to solve this.

class GetHandler(tornado.web.RequestHandler):
    @tornado.web.asynchronous

    # Getting user ID is working
    def get(self, user_id):

        # This is something I'm not sure is right, but found it in an 
        # example. I haven't created the code_received function yet, 
        # nor know if it should be here? Should the code_received
        # and connection finishing be called from the /set part?

        cursor = self.get_argument("cursor", None)
        self.wait_for_code(self.code_received, cursor=cursor)

    def code_received(self, data)
        self.write(data)
        self.finish()

All help very much appreciated. Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:24:40+00:00Added an answer on May 30, 2026 at 6:24 pm

    I actually managed to fix this, found the solution.

    Just to recap in case someone else is looking into this: I saved the listeners to a dict with the user_id and when the /set was called, i messaged the listener with the same user_id. If someone is interested, I can share more code.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning C, but i have a long experience with higher level programming languages
I have known PHP basics, functional programming for a long time before. But this
I'm new to C++ programming, but have been working in C and Java for
I have a long string, want to break that string in new line after
I have been programming in PHP and C# for a long time, but I
I have recently started programming in Perl (I'll skip the long story) but I've
I understand object oriented programming, and have been writing OO programs for a long
I have been programming with Delphi for a long time, and I focused on
Here's the background. I'm sorry it's so long: I do SAS programming for 3
I am new to web programming, coming from a video game development background (c++),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.