문제

I want to notify the browser side via javascript about an approaching session timeout.

My current implementation polls a URL every so often to find out if X seconds remain until session timeout.

For purely academic scaling reasons, what is an alternative to polling for session timeout on a Torquebox2 environment?

For example if I use a websocket server, how do I add session timeout information for the user and is it possible to have the client side trigger immediately after the information is pushed?

Is there a simple gem or alternative that does the bulk of work for me?

도움이 되었습니까?

해결책

Web sockets would surely be better than polling.

There is a good example of web socket usage in torquebox here https://github.com/torquebox/stomp-chat-demo

In this example, session information is set and read both in the Sinatra application and in the stomplets (analogous to an http controller but for web sockets). The documentation for web sockets in TorqueBox shows how to use the session both in your application controller and your stomplet here http://torquebox.org/documentation/current/stomp.html#d0e3602

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top