taoensso / sente

Realtime web comms library for Clojure/Script

Home Page:https://www.taoensso.com/sente

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for additional client/server adapters

ptaoussanis opened this issue · comments

LAST UPDATED: 2023 Mar 7

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

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:

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?

commented

@wilkerlucio there is an old PR from @Frozenlock that you may want to have a look at: #275

Closing to replace with a new issue at #425