sente
sente copied to clipboard
Add support for additional client/server adapters
LAST UPDATED: 2016 July 13
Sente currently supports #{:clj :cljs :node} servers and #{:cljs :node} clients.
Current server adapters
- http-kit (default server)
- Immutant v2+
- nginx-clojure v0.42+
- Aleph
- Cljs-based: Node.js (generic, Express, Dog Fort)
Writing a new server adapter
To add support for an additional server, a small adapter needs to be written. In most cases, the adapter should be pretty easy to write.
See here for up-to-date instructions on how to write an adapter and here to browse the current adapter implementations as examples.
Otherwise feel free to ping with any questions. Cheers! :-)
Hi, Taoussanis, Are implementing these two interface enough? I found that some codes use keyword :websocket? to check whether a request is a websocket Upgrade request or not, e.g. https://github.com/ptaoussanis/sente/blob/a210107f5a39bc8e33f9402dbd88af72bac1e526/src/taoensso/sente.cljx#L456 . Does it mean that if a server supports sente it must make sure [:websocket, true] is in its request map if the request is a websocket Upgrade request?
Hi Zhang,
Does it mean that if a server supports sente it must make sure [:websocket, true] is in its request map if the request is a websocket Upgrade request?
Yes, that is correct.
So a server must implement the two interfaces, and must set :websocket? true
in the Ring request map of WebSocket handshake requests.
Thank you for mentioning this, I had forgotten to :-)
Hi, Taoussanis,
In line with sente.cljx#L620, IAsyncNetworkChannel/send!*
MUST return true if the channel is not closed before sending.It it right?
Thanks in advance.
Yes, send!
must return:
- Something truthy if the channel is open when called
- Something falsey if the channel is closed when called
Has anybody tried to write an adapter for Tomcat (8)?
#80 was closed, but can the JVM server adapters also be used as clients? Much of the client code looks cljs
only.
Hi there,
#80 was closed to merge the issue with this issue (#102). As described above:
Sente currently supports #{:clj :cljs :node} servers and #{:cljs :node} clients.
I.e. no JVM clients are currently available, but PRs would be welcome. Cheers :-)
@ptaoussanis is there any support for Clojure clients? I want to have a Clojure on JVM process connecting to a sente WS process running in node (in an electron app in my case). What's the direction to make this work?
@wilkerlucio there is an old PR from @Frozenlock that you may want to have a look at: https://github.com/ptaoussanis/sente/pull/275
Closing to replace with a new issue at https://github.com/ptaoussanis/sente/issues/425