[Twisted-web] Athena LiveElement: how to putChild under unique
session URL?
Paul Reznicek
maillists at ivsn.com
Wed Apr 22 10:47:32 EDT 2009
CORRECTED PREVIOUS ANSWER
glyph at divmod.com wrote:
> On 21 Apr, 08:57 pm, maillists at ivsn.com wrote:
>> Hello All,
>>
>> LiveElement is fantastic, but I'm too stupid to find out,
>> how to put temporary page under sessiop URL...
>> This work for js modules at start like:
>> http://localhost:8080/user/<HASH clientID>/jsmodule/athena_test
>>
>> I'd like to add temporary during run time something like:
>> http://localhost:8080/user/<HASH clientID>/your_data
>> page or staticFile, which should exists only few minutes.
>>
>> How can I add a child to the livepage session path?
>
> The magical hash URL you're referring to is just an alias for your page
> instance. So all you need to do is, in your LiveElement:
>
> self.page.putChild("your_data", YourDataResource())
>
> That YourDataResource() object (and its attendant URL) will then live as
> long as your LivePage connection does.
>
> This is an interesting use-case, and it should work fine - but be aware
> that you're relying on a pretty weird little corner of implementation
> details here. It certainly never occurred to *me* that somebody would
> want to do this :).
>
> Particularly, there's no public API for generating this URL; you'll have
> to rely on the fact that url.here.child(self.clientID) keeps working.
>
Sorry for confusing - your solution WORK FINE, even better than my,
I used wrong testing method.
Open question is, how to find out, that client is gone. To stay with
chatterbox example:
ChatRoom().chatters is a list of registered clients
How can I check, who of them is still connected and who is invalid,
so I can delete them from the list?
Thanks again,
Paul
More information about the Twisted-web
mailing list