Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add support for plain standard websocket!!! #1033

Open
sergeych opened this issue Nov 22, 2020 · 4 comments
Open

Please add support for plain standard websocket!!! #1033

sergeych opened this issue Nov 22, 2020 · 4 comments

Comments

@sergeych
Copy link

Atmosphere is not a websock. Its a monster. Not working ugly slow buggy monster. At least with scalatra and jetty.
Getting random errors like:

18:44:41.492 WARN  o.a.w.DefaultWebSocketProcessor  - Failed invoking AtmosphereFramework.doCometSupport()
java.lang.NullPointerException: null
	at org.scalatra.atmosphere.ScalatraAtmosphereHandler.$anonfun$onRequest$3(ScalatraAtmosphereHandler.scala:76)
	at org.scalatra.ApiFormats.withRouteMultiParams(ApiFormats.scala:180)
	at org.scalatra.ApiFormats.withRouteMultiParams$(ApiFormats.scala:171)
	at net.sergeych.myonly.MyOnlyCloudServlet.withRouteMultiParams(MyOnlyCloudServlet.scala:21)
	at org.scalatra.atmosphere.ScalatraAtmosphereHandler.$anonfun$onRequest$2(ScalatraAtmosphereHandler.scala:70)

Or something else. It just does not work. With all 100 variants of configuration I've googled out for lath month. At all.

all the time and nothing helps, I've tried about 30 different approaches to configure this beast work in simple small setup with jetty launcher. Moreover, it does not support binary frames (it just silently does not send them), so we are restricted to base64... It sucks. And last of last, without their js library its PAIN in the ass. We connect from native applications where is just no js, no browser at all. And this ygly buggy stuff sends some random X - messages, swallows binary frames and disconnects by itself. It ignores standard pings and wants something else (supposedly it wants to be removed?)

Insofar, I should admit, writing API web service from scratch without apache, servlets and atmpsphere should take less time and effort than trying to make this bugmill work...

This is a BIG pity because scalatra is small and beautiful. All it needs is to start without buggy, slow, outdated and overcomplicated servlet containers and have own websock endpoing integrated.

@takezoe
Copy link
Member

takezoe commented Nov 29, 2020

Yeah... Atmosphere is one of big tech debts in Scalatra. Actually, we have been struggling to support it in Scalatra because it sometimes works on some application servers, but doesn't work on others.

I really would like to drop Atmosphere support from Scalatra. I think incompatible change for this can be acceptable in the next major upgrade (Scalatra 2.8 or 3.0?), however, implementing WebSocket support instead will require another effort and design consideration ahead. Do you have any good idea how to support WebSocket in Scalatra?

@magnolia-k
Copy link
Contributor

For future maintainability of Scalatra, we can specify it as deprecated once in Scalatra 2.8 as well as Scalate support.

And we'd better rethink our support for Json4s!

@sergeych
Copy link
Author

sergeych commented Jan 29, 2021

Worst of atmosphere is that it may work for s while on the same production environment then start to emit strange errors. Right now it works, just sends me 'X' messages sometimes. Ignore it, use signed packahes to be sure it's me not atmosphere has sent.

I would love to see in scalatra some extremely simple and straightforward websocket implementation, maybe written from scratch. We actually don't need any fallbacks and IE 6 support, the standard is now mature and supported everywhere. Any browser is capable of sendind and receiving wbesocket messages in just 5-6 lines of code, so I think no client js libs too. Text and binary messages send/receive with simple callback style interfaces will be more than OK. In my long and large experience websocket is used almost exclusively to push server events, not to create complex 2-way protocols, so no akka, no actors, no server farm to execute incoming socket message on a random host, no few hundred megs of unneeded code, just send message/receive message, connect/disconnect.

And yes, rethinking json4s is a right idea!

@magnolia-k
Copy link
Contributor

Jetty has reworked WebSocket in version 10, so version 10 or later will be the target.

Also, since WebSocket does not have an interface standard like Servlet, it is necessary to create an abstraction layer for the application server.

A good place to start is to target Jetty 10 and prepare a layer such as sinatra-websocket.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants