It is possible to have the clients browser poll the server for a message every N seconds. Your standard page template can include a small frame that calls a page containing an HTML reload directive. The reload would call a function for maintaining "logged in" state, and returning a page with messages, and another reload in N seconds command. Your concept of "Logged In" then becomes any user that still has your page open on their web browser - a user is no longer "logged in" when the server has not recorded such a request in the last N+1 seconds. The function could also check for any new server status or alarm messages and include them in the returned page, display status messages discreetly in the small frame, and alarm messages as a JavaScript popup window activated from an onLoad command on the returned page. One annoying side effect would be that some browsers play a CLICK noise whenever reloading a page, and this would happen every N seconds - although it might serve as a reminder to users that they have left themselves "logged in" to your system. :-) --Sean
-----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org]On Behalf Of Dennis Allison Sent: Monday, October 18, 2004 12:20 AM To: Jens Vagelpohl Cc: Zope List Mailing Subject: Re: [Zope] Sending an alarm message to all logged-in users
We have a fairly complex multi-frame presentation. As I indicated, I could do it by doing a test, but that's costly in our particular situation. I'm looking for something a bit lower overhead.
On Sun, 17 Oct 2004, Jens Vagelpohl wrote:
On Oct 17, 2004, at 18:14, Tino Wildenhain wrote:
Hi,
Am So, den 17.10.2004 schrieb Dennis Allison um 17:52:
Occasionally I have wished for a mechanism that would allow me to write all logged-in users. Of course, this could be acomplished with an explicit test, but making the test costs a lot of overhead. Is there a better way?
HTTP is stateless. There is no such thing like "logged in". Calls are only send from client to server, never the other way round. Thus, you cannot "send" something to all users.
One way to fake this out (as Tino already says, the concept of "logged in user" is kind of meaningless) would be to have a slot in your main template that would display something if...
- the current visitor has sent valid login information for the request (meaning the user for the duration of the request is not "Anonymous User")
- you fill some variable, maybe a property at the site root, or change a script that returns something, with your message.
Those things can be tested for easily.
jens
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )