Josh Glover
Josh Glover

Reputation: 26150

Using websockets in Clojure Ring app deployed to Tomcat

I'd like to deploy a websocket server to a Tomcat container running on AWS Elastic Beanstalk using Ring. I'm not sure how to go about doing that, or if it is even possible without writing a Ring adapter that supports websockets.

I took a look at ring.util.servlet, and it looks like it only handles HttpServlet. In order to use websockets with Tomcat, I need to extend WebSocketServlet.

I know about http-kit, which looks really great, but I won't be able to deploy it to Elastic Beanstalk, as it can't run in an application container, but must run as a standalone app.

Has anyone deployed a websockets Ring app to Tomcat?

Upvotes: 1

Views: 696

Answers (2)

joshua
joshua

Reputation: 4198

You can also have a look at vertx which has built in support for websockets. There is a clojure language support. see here.. There is a ring adapter here. You could also read about how to embed vertx in your clojure ring based application.

If you are free to use something else besides tomcat, you can try immutant which is based on jboss. Here is an article on immutant, vertx and websockets.

Josh

Upvotes: 1

pwnyexpress
pwnyexpress

Reputation: 1016

Yes, http-kit is meant to be used in lieu of Tomcat, but you can use a reverse proxy like nginx. If that's something you really don't want to do, you could consider using Pedestal with SSE instead of websockets.

Other than that, it doesn't look like there are any ring libs for websocket support, so you'd have to pioneer it yourself.

Upvotes: 1

Related Questions