A WebSocketServlet for Jetty 9 that offloads WebSocket communication
to core.async
channels.
This is heavily inspired by jetty7-websockets-async.
jetty9-websockets-async is tested on Clojure 1.5.1 only. It may work on other Clojure versions.
This is alpha quality software.
jetty9-websockets-async is available as a Maven artifact from Clojars:
[org.tobereplaced/jetty9-websockets-async "0.2.1"]
jetty9-websockets-async follows Semantic Versioning. Please note that this means the public API for this library is not yet considered stable.
Please read the Codox API Documentation, as it contains all of the information you would like to know.
I generally don't believe in wrapping libraries because doing so often
makes them less flexible. In this particular case, I can't possibly
know all of the things you want to do with your web server.
Consequently, instead of making a configurator
for
ring-jetty-adapter
, I have exposed a function you can use to create
a WebSocketServlet or a WebSocketClient that offloads
communication onto core.async
channels. What you do with it is up
to you.
If you're looking for example code embedding this servlet in an application, take a look at the example jetty-chatroom. Also, the complete unit tests may be of interest.
Please post any comments, concerns, or issues to the Github issues
page or find me on #clojure
. I welcome any and all feedback.
- Add
<!
to require statement for newer versions ofcore.async
.
- Add type hint for return of
servlet
. :go-loop
has been renamed:process-channel
.- Add exception and closing information to the process result.
- API is backward compatible only if you did not use the
:go-loop
key.
- Initial Release
Copyright © 2014 ToBeReplaced
Distributed under the Eclipse Public License, the same as Clojure. The license can be found at LICENSE in the root of this distribution.