sente icon indicating copy to clipboard operation
sente copied to clipboard

Add support for additional client/server adapters

Open ptaoussanis opened this issue 9 years ago • 9 comments

LAST UPDATED: 2016 July 13

Sente currently supports #{:clj :cljs :node} servers and #{:cljs :node} clients.

Current server adapters

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! :-)

ptaoussanis avatar Feb 08 '15 09:02 ptaoussanis

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?

xfeep avatar Aug 13 '15 06:08 xfeep

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

ptaoussanis avatar Aug 13 '15 06:08 ptaoussanis

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.

xfeep avatar Aug 23 '15 07:08 xfeep

Yes, send! must return:

  • Something truthy if the channel is open when called
  • Something falsey if the channel is closed when called

ptaoussanis avatar Aug 23 '15 07:08 ptaoussanis

Has anybody tried to write an adapter for Tomcat (8)?

celwell avatar Apr 30 '16 22:04 celwell

#80 was closed, but can the JVM server adapters also be used as clients? Much of the client code looks cljs only.

Frozenlock avatar Sep 29 '16 12:09 Frozenlock

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 avatar Sep 30 '16 03:09 ptaoussanis

@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 avatar Apr 04 '20 23:04 wilkerlucio

@wilkerlucio there is an old PR from @Frozenlock that you may want to have a look at: https://github.com/ptaoussanis/sente/pull/275

nha avatar Apr 05 '20 18:04 nha

Closing to replace with a new issue at https://github.com/ptaoussanis/sente/issues/425

ptaoussanis avatar Mar 07 '23 16:03 ptaoussanis