[Play 2.1.x] Websocket fallback?

797 views
Skip to first unread message

Pere Villega

unread,
May 12, 2013, 10:39:57 AM5/12/13
to play-fr...@googlegroups.com
Hi,

testing some stuff, I was wondering if any of you have used any WebSocket fallback with Play? The ones I see (Socket.io, SockJS, etc) seem to depend on a server-side implementation.

Any of you has an example on the way you managed the fallback?

Cheers,
Pere

Julien Richard-Foy

unread,
May 13, 2013, 5:38:13 AM5/13/13
to play-fr...@googlegroups.com
I think you have to use two different actions to handle the WebSocket case and the fallback case. For example:

GET    /channel        controllers.Application.channelFallback(fallback)
GET    /channel        controllers.Application.channel

object Application extends Controller {

  def channelFallback(ignored: String) = Action {
    // Use whatever fallback you want (e.g. Comet)
  }

  val channel = WebSocket {
    // …
  }

}

Jelan

unread,
May 14, 2013, 11:21:59 AM5/14/13
to play-fr...@googlegroups.com
Just in case you didnt know, there is now an atmosphere plugin for Play 2.1 which would take care of this for you.

Pere Villega

unread,
May 14, 2013, 3:32:26 PM5/14/13
to play-fr...@googlegroups.com
Thanks for the answers, will check both options :)


On Tuesday, May 14, 2013 4:21:59 PM UTC+1, Jelan wrote:
Just in case you didnt know, there is now an atmosphere plugin for Play 2.1 which would take care of this for you.

ibsdevs

unread,
Jul 14, 2013, 9:16:44 AM7/14/13
to play-fr...@googlegroups.com
Does that atmosphere plugin work with Play 2.1.x Scala? Are there examples using scala?

matthew.hi...@gmail.com

unread,
Oct 11, 2013, 11:07:04 AM10/11/13
to play-fr...@googlegroups.com
Same question here, would love to know if this is supported in Play Scala also (preferably 2.2.0)

Viktor Koop

unread,
May 23, 2014, 6:03:19 AM5/23/14
to play-fr...@googlegroups.com
Is Atmosphere the way to go, if you want to have fallback for websockets? Just wondering why PlayFramework on its own doesn't care about fallbacks. Websockets are nice but considering that Android only introduced Websockets in Version 4.4 it seems to be necessary to provide fallbacks.
Message has been deleted

Francesco Di Muccio

unread,
May 26, 2014, 11:10:07 AM5/26/14
to play-fr...@googlegroups.com
Il giorno domenica 12 maggio 2013 16:39:57 UTC+2, Pere Villega ha scritto:
Hi,

Hi,
 

testing some stuff, I was wondering if any of you have used any WebSocket fallback with Play? The ones I see (Socket.io, SockJS, etc) seem to depend on a server-side implementation.

Here is a Play2 implementation for SockJS: https://github.com/fdimuccio/play2-sockjs
It has scala and java API very similar to the WebSocket one in play. I hope it could be useful.

Francesco
Reply all
Reply to author
Forward
0 new messages