1
votes

I am following the following tutorial to construct a websocket: http://blueprintforge.com/blog/2012/02/13/websockets-in-play-2-dot-0

It works for me. However, I would like to use the websocket to show the progress of a form submission/job. After my job is done running, I want to redirect the user to a static url.

In play framework, you can return

WebSocket<String>

instead of

Result

But result will let you redirect by returning redirect('www.domain.com/job8273')

Is this possible to redirect using websockets?

1

1 Answers

4
votes

You can obtain an upload finished message and redirect with JavaScript:

websocket.onmessage = function(evt){
    if(evt.data=="finished") 
      window.location.href = 'www.domain.com/job8273';
}