No description provided.
Eagerly waiting for this!
+1 definitely looking forward to this.
I've actually written up a small extension to the spray-can http server that adds websocket functionality. It's over at https://github.com/lihaoyi/SprayWebSockets with instructions for how to try it out, and it should work with the 1.1-M7 nightly builds.
The server has been continuously serving websocket connections for the last two months on the toy site I made to test it out (http://www.textboxplus.com/), so it seems to work. There are instructions in that project's readme as to how to use it. Installation basically involves copying to source files into your project (sorry no .jar, but it's less than 500 lines of code anyway). The plan is to contribute it back into the main repo when 1.1-M8 comes out.
Guys, websockets support is not enough:
Global browser support of websockets is nearly 70%. Not bad, but IE9 (and below) and all Android versions don't support websockets at all. So we are forced to use long polling, xhr streaming or something else with these browsers.
Websockets protocol has few serious (more or less) drawbacks that makes it hard to develope pretty complex applications such as chats. For more details see this and that.
What we really need is abstraction layer for asynchronous communications between browser and server with fallbacks to best available transport (websockets, long polling, etc). Something lile Bayeaux, SockJS or Socket.IO. That's why our competitor, vert.x framework, supports not only websockets, but full-blown SockJS. That's why Atmosphere framework provides high-level abstraction layer above details of websockets, long polling or other low-level transport protocols. These abstractions in API help to develope complex asynchronous applications.
P.S. By the way, SocksJS is much more preferred protocol above Socket.IO. See detailed analysis by author of Tornado (Socket.IO implementation for python).
Thanks for the analysis, @nartamonov. I agree with you and spray websocket support will enable other higher-level solutions like the ones you are describing. We will first focus on websocket support itself because that's something that has to live in spray(-can) itself. More higher-level abstractions on top may then be provided by spray itself or can also be built by third-party extensions.
Would you create another issue for the high-level solution?
Before this support is ready in spray, what do you think we use scalawebsocket ( https://github.com/pbuda/scalawebsocket) in the mean time ?
https://github.com/pbuda/scalawebsocket looks like WebSocket client. You need a server.
There are several offers in the market but I don't see any of them fitting in the actor based nature of Spray. Maybe the ones that integrate with Play Framework are the closest. See https://github.com/Atmosphere/atmosphere-play and https://github.com/flowersinthesand/portal-java/tree/master/play
Scalatra seems also have integration with Atmosphere:
I've updated https://github.com/lihaoyi/SprayWebSockets to be compatible with 1.2-M8, and it passes all of the Autobahn test suite as both client and server. Not tracking trunk because things are constantly changing, and I'll wait until a release is landed before updating to it and putting an artifact on maven. In the meantime you can just add the github URL to sbt and it'll immediately start working.
Is this feature still on track for the final 1.2 release? If not, when can we expect it?
@pmlt This feature will not be part of the 1.0/1.1/1.2 final.
It will become available with the move of play onto the new akka-http sometime next year.
My standalone spray websocket server/client (https://github.com/lihaoyi/SprayWebSockets) has been updated to work against 1.2-RC3, if anyone wants to give it a shot and you don't want to wait.
SprayWebSockets has been updated to work with spray-can 1.2. Although it's not super speedy, it passes more or less the entire websocket test suite, so if you need a websocket server in a pinch it'll work
great work Li! thanks!
Recently Akka team plans to replace the pipeline architecture and IMO it is good chance to add "upgrade protocol" support to the Akka's pipeline.
@lihaoyi 's really awesome SprayWebSocket, for example, needs to re-implement whole spray's http pipeline to switch the protocol. It seems little bit verbose.
+1 - Atmosphere support
Maybe a smaller feature that will pave the way for websocket support is to just add support for Switching Protocols (see http://tools.ietf.org/html/draft-ietf-httpbis-p1-messaging-26#section-6.7) in Spray client and server. Then an external library can provide websocket support, without that library having to hook deep into the internals of spray.
+1 again and again
+1, because it just takes soooo long to scroll to the end of this list and all.
I hope it will be possible to use Atmosphere framework with Spray
Atmosphere does look very interesting. The support for different protocols over the ws: connection looks promising.
Have you considered using one of the existing spray websocket implementations to create an integration with Atmosphere? It would be cool to see it running!
@troypayne Not sure if that was directed to me, I've been successful integrating against spray-websockets for now. Atmosphere seems to be very comprehensive with protocol support, and being built on Netty, seems like it would be easier to acquire new protocols that work with it. New protocols means more capabilities. I have no idea whether it's practical or not, which is why I was suggesting an advocate look at something like spray-websockets and wrap Atmosphere with the spray integration plumbing from it.
I have tried to integrate spray with atmosphere, but it seemed little bit complicated because the atmosphere has its own semantics to provide full-stack HTTP server functionality. I couldn't find a sub-module only just handling the protocol, instead of the whole stack.
All, Mathias discussed websockets as a specific goal of the conversion of Spray to use Reactive Streams under akka-http. Suggest checking out his video from ScalaDays in Berlin!
This looks pretty good. https://github.com/wandoulabs/spray-websocket
Can already use https://github.com/TooTallNate/Java-WebSocket (see here for inspiration). Shouldn't websocket support actually make more sense first as part of Akka, then bubble up to spray? Anyway Play already implements websocket, it might make sense to converge the two around the same core implementation...
@matanster - Yes, it would and that is what's in the works right now, I believe. When akka-http is released they will shortly thereafter release websocket support for it. Might take another quarter or so. Perhaps one of the akka/spray developers can comment on the status of this?
We've considered this request and found that we need more evidence that anyone would find this useful.
Just joking... :D The time may have finally come that we are actually going to implement this as part of akka-http. Here's the new ticket: akka/akka#16848
@matanster: @jrudolph is obviously trolling you.
@matanster, yes, I was trolling. I hope you didn't take offence.
Closing for spray. See the akka/akka#16848 for the most recent developments.