GithubHelp home page GithubHelp logo

rtroberts / clj-socketio-client Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ejschoen/clj-socketio-client

0.0 0.0 0.0 13 KB

Clojure wrapper for socketio/socket.io-client-java

License: MIT License

Clojure 100.00%

clj-socketio-client's Introduction

clj-socketio-client

A Clojure library that wraps https://github.com/socketio/socket.io-client-java

Installation

Leiningen

[clj-socketio-client "0.1.0-SNAPSHOT"]

Usage

The Clojure wrapper provides a thin convenience layer atop the Java client.

(:require [clj-socketio-client.core :as sio])

(def s (sio/make-socket "http://host:port" event-map))
(sio/emit! s "message" args optional-unique-id)

The event map provided to make-socket maps standard or custom socket.io event names to variadic [& args] functions, which will be called asynchronously when messages are received.

The args argument to emit! may be a map, a sequential object (list, vector, ...) or a primitive (string, number, true false). The arguments are JSON-encoded into an array for transmission.

For convenience, the following are also available:

(sio/make-pass-take-socket url) constructs a socket with a predefined event map. When the socket is opened, it sends a "join" message, with a unique identifier.

(sio/pass-take msg) emits a "pass" message with the given msg arguments, and (synchronously) returns a Clojure promise to the value of a corresponding received "take" message from the remote service. The promise times out if not delivered within 60 seconds.

License

Copyright © 2016 i2k Connect LLC

Distributed under the MIT License.

clj-socketio-client's People

Contributors

ejschoen avatar rtroberts avatar wibisono avatar rockchalkjay avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.