This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-27
Channels
- # announcements (2)
- # aws (17)
- # babashka (13)
- # beginners (84)
- # calva (46)
- # chlorine-clover (40)
- # cider (19)
- # clojure (27)
- # clojure-australia (1)
- # clojure-europe (84)
- # clojure-nl (2)
- # clojure-uk (49)
- # clojurescript (65)
- # core-async (6)
- # cryogen (1)
- # cursive (11)
- # datomic (13)
- # etaoin (3)
- # jackdaw (5)
- # jobs (2)
- # kaocha (34)
- # minimallist (6)
- # off-topic (17)
- # pathom (2)
- # pedestal (11)
- # re-frame (8)
- # reagent (5)
- # rewrite-clj (19)
- # shadow-cljs (30)
Would a websocket stream be a case to implement the clojure.core.async/Mult
protocol? so that you can call tap
on it to put incoming messages on a channel? Or is it probably better to just have the websocket provide an output channel for the user to make their own mult?
If you want a mult you don't need to implement protocols, just use the mult
function to make one and put websocket messages into its channel.
When you have multiple consumers, typically you'd have a central mult they can tap into, or you can use pub/sub for topic-based dispatch.
Yeah, I was using a mult already in this way. I just wasn't sure if making my websocket client itself a Mult
, as a small shortcut, is an intended use of that protocol. I guess I'm just wondering what kind of situations might that protocol be extended, or is it always a bad idea?
In my usage of websocket I do almost always want a mult.
But I suppose most websocket client implementations expose just attaching a single handler for received messages, so that would map more cleanly to a single channel for received messages, as a base.
But then maybe I could have a MultWebsocketConnection
that could just be async/tap
ed directly?
Just thinking out loud here 🙂