wsockmq
v0.1.2
Published
pubsub library with core.async and websocket
Downloads
1
Readme
- wsockmq
This is clojurescript library for http push, it's based on websocket transport and clojure.core/async and models message queue pub/sub api. Until [[https://github.com/ring-clojure/ring/issues/393][ring-2]] is released, server websocket can be implemented with [[https://github.com/sunng87/ring-jetty9-adapter][ring-jetty9-adapter]], [[https://github.com/ztellman/aleph][aleph]], [[https://github.com/jarohen/chord][chord]]
- Usage
#+begin_src sh npm install wsockmq #+end_src
Caller is repsonsible for freeing connection
#+begin_src clojure (with-open [socket (WebSocket.)] (let [url "wss://echo.websocket.org"] (doto (->WSockMessageQueue socket url) (subscribe :hello (fn [{:keys [payload]}] (println payload))) (publish :hello "world") (unsubscribe :hello)))) #+end_src
- License
Copyright © 2020, turbocafe. All rights reserved.
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0.