Skip to content
NetMQ F# Binding
Branch: master
Clone or download
Latest commit ba327a0 May 8, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
src supporting peer socket type Nov 4, 2017
.gitignore Create .gitignore Aug 27, 2017
LICENSE Create LICENSE Oct 26, 2017 Update May 8, 2018



use router = Socket.router ()
router.bind socket "tcp://*:6566"

use dealer = ()
Socket.connect socket "tcp://"

Frame.send dealer "Hello"B

let frame,more = Frame.recv router


Poller is using IObservable, so when ever you add a socket to the poller you get an observable which you can subscribe to be notified of new messages.

use poller = Poller.create ()
use dealer = ()
use subscriber = Socker.sub ()

// Connecting and subscribing...

let dealerObservable = 
  Poller.addSocket poller dealer
  |> Frame.recv
let subObservable = 
  Poller.addSocket poller subscriber
  |> Frame.recv

use observer = 
  Observable.merge dealerObservable subObservable  
  |> Observable.subscribe (fun msg -> printfn "%A" msg) poller


Actor is a thread with socket attached to it, so you are able to send it messages and request cancellation. Together with Poller it is a powerful concept.

// Actor is disposable, so whenever you call dispose on the actor the end message will be sent the thread will exit
let actor = 
  Actor.create (fun shim -> 
    use poller = Poller.create ()
    // Registering for the end message which will cancel the actor
    use emObserver = Poller.registerEndMessage poller shim

    // Creating sockets and adding them to the poller
    // Signalling that the actor is ready, this will let the Actor.create function to exit
    Actor.signal shim poller
You can’t perform that action at this time.