Skip to content

spray-can: add websockets support (client & server) #134

Closed
sirthias opened this Issue Sep 4, 2012 · 129 comments
@sirthias
spray member
sirthias commented Sep 4, 2012

No description provided.

@analytically

+1

@tommcp
tommcp commented Nov 1, 2012

+1

@t3hnar
t3hnar commented Nov 10, 2012

+1

@alexbool

+1

@olger
olger commented Nov 17, 2012

+1

@pjean
pjean commented Nov 29, 2012

+1

@edgurgel

+1

@zerni
zerni commented Dec 10, 2012

+1

@Bathtor
Bathtor commented Dec 10, 2012

+1

@csenol
csenol commented Dec 16, 2012

+1

@lihaoyi
lihaoyi commented Dec 26, 2012

+1

@RajivKurian

+1

@soaexpert

+1

@siriux
siriux commented Jan 22, 2013

+1

@shogs
shogs commented Jan 25, 2013

+1

@ramn
ramn commented Feb 9, 2013

+1

@tlvenn
tlvenn commented Feb 13, 2013

+1

@sharathp

Eagerly waiting for this!

+1

@hseeberger

+1

@enijns
enijns commented Feb 21, 2013

+1

@JMacLulich

+1 definitely looking forward to this.

@paulsabou

+1

@slothspot

+1

@shimberger

+1

@dacc
dacc commented Mar 5, 2013

+1

@mdmarek
mdmarek commented Mar 14, 2013

+1

@Grogs
Grogs commented Mar 22, 2013

+1

@lihaoyi
lihaoyi commented Mar 22, 2013

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.

@cicika
cicika commented Mar 28, 2013

+1

@pirtlj
pirtlj commented Apr 11, 2013

+1

@g-eorge
g-eorge commented Apr 11, 2013

+1

@kulikov
kulikov commented Apr 12, 2013

+1

@drewhk
drewhk commented Apr 30, 2013

+1 ;)

@macinux
macinux commented May 4, 2013

+1

@jgrowl
jgrowl commented May 4, 2013

+1

@avaello
avaello commented May 16, 2013

+1

@greenhost87

+1

@dvorobiov

+1

@nartamonov

+1

@mnetship
@romusz
romusz commented Jun 24, 2013

+1

@nartamonov

Guys, websockets support is not enough:

  1. 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.

  2. 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).

@jrudolph
spray member

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?

@mweibel
mweibel commented Jul 9, 2013

:+1:

@natalinobusa

+1

@karthikkolli

+1

@kthakore
kthakore commented Aug 5, 2013

+1

@romansergey

+1

@jestan
jestan commented Sep 4, 2013

+1

@reinierl

+1

@agarman
agarman commented Sep 19, 2013

+1

@chesterxgchen

Before this support is ready in spray, what do you think we use scalawebsocket ( https://github.com/pbuda/scalawebsocket) in the mean time ?

Any suggestions?

@martin-g

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

@chesterxgchen

Scalatra seems also have integration with Atmosphere:

http://ymasory.github.io/websockets-and-akka-on-scalatra/#slide-126

@ctataryn

+1

@lihaoyi
lihaoyi commented Oct 17, 2013

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.

@taylorleese

+1

@kardapoltsev

+1

@cheebo
cheebo commented Oct 29, 2013

+1

@maliqq
maliqq commented Nov 1, 2013

+1

@pmlt
pmlt commented Nov 12, 2013

Is this feature still on track for the final 1.2 release? If not, when can we expect it?

@AhmedSoliman

+100

@sirthias
spray member

@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.

@lihaoyi
lihaoyi commented Nov 18, 2013

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.

@laguiz
laguiz commented Nov 19, 2013

+1

@michalj
michalj commented Dec 4, 2013

+1

@levinotik

+1

@lihaoyi
lihaoyi commented Dec 10, 2013

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

@dvorobiov

great work Li! thanks!

@martinring

+1

@canyaman

+1

@pcting
pcting commented Dec 30, 2013

:+1:

@carueda
carueda commented Jan 1, 2014

:+1:

@pm47
pm47 commented Jan 2, 2014

+1

@rkatti
rkatti commented Jan 4, 2014

+1 +1

@AndriiRubtsov

+1

@villiger
villiger commented Jan 6, 2014

+1

@bchapuis
bchapuis commented Jan 8, 2014

+1

@mgibowski

+1

@DarrenMowat

+1

@zdexter
zdexter commented Jan 19, 2014

+1

@troypayne

+1

@s-a-y
s-a-y commented Jan 27, 2014

+1

@rejjin
rejjin commented Jan 28, 2014

-1

@boui
boui commented Feb 7, 2014

+1!!

@okapies
okapies commented Feb 8, 2014

+1!

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.

https://groups.google.com/d/msg/akka-user/8fZ75MlVEYc/YaZGsysG8mcJ

@jtrunick

+1 - Atmosphere support

@dborovikov

+1!

@spierce7

+1

@aoiroaoino

+1

@markvandertol

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.

@crfeliz
crfeliz commented Mar 12, 2014

+1

@kaesler
kaesler commented Apr 4, 2014

+1

@nefilim
nefilim commented Apr 5, 2014

+1

@kulikov
kulikov commented Apr 9, 2014

+1 again and again

@briantopping

+1, because it just takes soooo long to scroll to the end of this list and all.

@sirthias sirthias referenced this issue in lihaoyi/SprayWebSockets Apr 17, 2014
Closed

It's not clear how to receive Acks on the client side #16

@martin-magakian

+1

I hope it will be possible to use Atmosphere framework with Spray

https://github.com/Atmosphere/atmosphere

@briantopping

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
@briantopping

@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.

@okapies
okapies commented May 15, 2014

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.

@milo-ft
milo-ft commented Jul 10, 2014

+1

@briantopping

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!

@jonysy
jonysy commented Aug 1, 2014

+1

@megothss

+1

@peter-empen

+1

@jurisk
jurisk commented Dec 11, 2014

+1

@psisoyev

+1

@skisel
skisel commented Dec 11, 2014

+1

@andyglow

+1

@dimitrion

+1

@angiolep

+1

@matanster

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...

@reid-spencer

@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?

@dnrusakov

+1

@nikelin
nikelin commented Jan 28, 2015

+1

@jrudolph jrudolph modified the milestone: akka-http, Future Feb 6, 2015
@jrudolph
spray member

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 :fireworks:

@jrudolph jrudolph referenced this issue in akka/akka Feb 10, 2015
Closed

Add support for websockets #16848

@matanster
@salanki
salanki commented Feb 10, 2015

@matanster: @jrudolph is obviously trolling you.

@jrudolph
spray member

@matanster, yes, I was trolling. I hope you didn't take offence.

@jrudolph
spray member

Closing for spray. See the akka/akka#16848 for the most recent developments.

@jrudolph jrudolph closed this Feb 11, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.