Giter VIP home page Giter VIP logo

chicken-nanomsg's Introduction

chicken-nanomsg

Chicken Scheme bindings for the lightweight ZMQ-alternative, nanomsg. There exists Chicken ZMQ bindings, but this turned out to be a little troublesome with zmq_poll blocking other srfi-18 threads.

Why nanomsg

Nanomsg is smaller, written in C, has a simplified API (sockets are simple ints), no multipart messages, and has explicit support for poll on a socket's recv file-descriptor.

Requirements

This egg requires nanomsg-0.4-beta. Not tested on nanomsg-0.5-beta.

Development Status

These bindings are incomplete. All protocols and transport types should be supported. However, socket options (nn_setsockopt and nn_getsockopt) aren't supported with the exception of nn-subscribe. If you're missing something, please create github issues!

Currently supported:

  • nn-socket records types with finalizer
  • nn-bind and nn-connect
  • nn-send and nn-recv
  • non-blocking nn-recv with (thread-wait-for-i/o!)
  • nn-subscribe for (nn-socket 'sub) sockets

Favored TODO's:

  • support socket options
  • bundle nanomsg itself?

All of nanomsg's protocols are supported:

  • Request/reply protocol (req rep)
  • Publish/subscribe protocol (pub sub)
  • Survey protocol (survey respondent)
  • Pipeline protocol (push pull)
  • One-to-one protocol (pair)
  • Message bus protocol (bus)

Sample

;; test.scm
(use nanomsg)

(define s (nn-socket 'rep))
(nn-bind s "tcp://127.0.0.1:22022")

(let loop ((n 0))
  (nn-send s (conc (nn-recv s) " " n))
  (loop (add1 n)))

(nn-close s)

then test with the brilliant nanocat util that comes with nanomsg:

$ csi -s test.scm &
$ nanocat --req -l22022 -D"bottles of beer:" -A --interval 1

chicken-nanomsg's People

Contributors

kristianlm avatar werelax avatar

Watchers

 avatar  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.