taoensso / sente

Realtime web comms library for Clojure/Script
https://www.taoensso.com/sente
Eclipse Public License 1.0
1.74k stars 193 forks source link

Android Client side for Sente? #332

Closed StankovicMarko closed 4 years ago

StankovicMarko commented 5 years ago

Greetings,

i am Clojure beginner and i've written full stack Clojure web app.

I had an idea to make mobile app too but i am only familiar with Android. So i am wondering if its possible to make java library that is client side only for Sente?

I was looking at the Sente source and i didnt have any ideas how it could be done. If it can be done, what would be the approach?

Id use this library inside Android app to communicate to already written backend that uses Sente.

danielcompton commented 5 years ago

If you're going to do Clojure on Android then it would be a matter of copying the current ClojureScript client code and converting it to be JVM client Clojure code. If you want to do it in Java, then you would need to then translate that Clojure code back to Java. It sounds doable but tricky to translate the semantics. You'd also need to convert any serialisation formats to run in Java too.

kaosko commented 4 years ago

I've created a fork of Sente (https://github.com/kaosko/sente/) that implements a pure Java websocket client. Just added passing headers, so you could do e.g. "Authentication [Bearer ....]" instead of the rather web centric session-id/csrf token security mechanism in the mainline Sente. Work in progress but it was surprisingly easily to hammer in https://github.com/TooTallNate/Java-WebSocket for the Java client (the implementation is modeled after browser websocket specs). Have not tested on Android though but if the WebSocket library runs on it, then the whole fork should work as well.

ptaoussanis commented 4 years ago

Addressed with https://github.com/ptaoussanis/sente/pull/374, closing.