Skip to content
yet another websocket client
Clojure Makefile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
autobahn
src/yawc
test/yawc
.gitignore
.travis.yml
Makefile
README.org
docker-compose.yml
project.clj

README.org

yawc (yet another websocket client) https://travis-ci.org/niklasfasching/yawc.svg?branch=master

A minimal (< 500 SLOC) websocket client in clojure - without any dependencies.

Passes the autobahn websockets testsuite (see results).

Usage

(require '[yawc.core :as yawc])
(let [client (yawc/open
              {:host "echo.websocket.org"
               :port 80
               :path "/"
               :cb (fn [type payload client]
                     (cond
                       (#{:text :close :connect} type) (println type payload)
                       :else (println type (String. payload))))})]
;; => :connect {:status 101, :reason Web Socket Protocol Handshake, :headers {connection Upgrade, date Sun, 01 Apr 2018 13, sec-websocket-accept g7Uq6gHNVaVhx/pERAJiHxDSs/w=, server Kaazing Gateway, upgrade websocket}, :content }
(yawc/emit client {:opcode 1 :payload (.getBytes "Hello World!")}))
;; => :text Hello World!

Todo List

You can’t perform that action at this time.