This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-31
Channels
- # aleph (1)
- # announcements (2)
- # beginners (105)
- # braveandtrue (1)
- # cider (61)
- # clara (47)
- # cljdoc (29)
- # cljs-dev (5)
- # clojure (61)
- # clojure-austin (14)
- # clojure-brasil (1)
- # clojure-india (3)
- # clojure-italy (4)
- # clojure-mexico (1)
- # clojure-nl (2)
- # clojure-spec (37)
- # clojure-uk (95)
- # clojurescript (73)
- # cursive (12)
- # data-science (1)
- # datomic (26)
- # duct (10)
- # emacs (5)
- # fulcro (47)
- # hoplon (6)
- # hyperfiddle (3)
- # jobs-discuss (3)
- # kaocha (2)
- # leiningen (3)
- # nrepl (8)
- # off-topic (3)
- # onyx (2)
- # re-frame (31)
- # reitit (16)
- # shadow-cljs (36)
- # spacemacs (46)
- # specter (16)
- # tools-deps (13)
- # yada (22)
I’m about to try integrating websockets into a yada handler. Are there any gotchas I should be aware of? I know Sente has support for Aleph so I was just going to go the Sente route as a first attempt
@oliver.mooney we use the aleph websocket support and a ring handler - it's lower-level than yada, but it's straightforward and operates happily alongside other yada handlers
@mccraigmccraig good to know, thanks
How I use it: I send a small message to the client that something should be updated. Then the client does the request to the server using the same logic that was already in place in Re-frame, etc. No special code needed
@borkdude thanks, I was thinking of using SSE for broadcasts but you use it to ping a particular client to pull updates from the server? Do your clients use normal http methods to return data to the server, so no websockets at all?
Sorry about the two accounts, a previous job required me to make a separate one that’s now derelict :face_with_rolling_eyes:
just store the channel(s) (plural if you want to support multiple open tabs) per client in an atom somewhere, by user-id
yeah, note that you also have to deal with closed channel when the user closes a tab, but you’ll figure it out
SSE is significantly superior to WebSockets for most things. King of them is that authorization works, and you don't need to develop your own scheme on top.
Games are the only use case that need the low latency that WS provides, as far as I know. Maybe chat too @mccraigmccraig? But you would need to convince me 😊
There's an example of using websockets in Edge (https://github.com/juxt/edge). We use it to do Graphql subscriptions, mostly because the Graphiql console is more mature for WS although we could have made it work with SSE too. You can use thr Authorisation header when upgrading the protocol to WS.
i’ve no idea what the sse latency is like @dominicm but unless it’s pretty bad it will probably be fine for chat... websockets were pretty trivial to implement tho, auth & all
one nice thing about the websocket api - it’s a bi-directional socket, so the client can keep on sending messages to modify what the server end is doing - we use this to subscribe and unsubscribe a user’s websocket to different topics of interest as the user moves around in the app