Skip to content

niklasfasching/yawc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •