Skip to content

autozimu/Nanomsg.swift

Repository files navigation

Swift binding for nanomsg

CircleCI

Usage

If Swift Package Manager is used, add this package as a dependency in Package.swift,

.Package(url: "https://github.com/autozimu/Nanomsg.swift.git", majorVersion: 0)

Example

Push

import Nanomsg

let sock = try Socket(.PUSH)
try sock.connect("ipc:///tmp/pipeline.ipc")
try sock.send("Yo!")

Pull

import Nanomsg

let sock = try Socket(.PULL)
try sock.bind("ipc:///tmp/pipeline.ipc")
let msg: String = try sock.recv()
print(msg) // Yo!

More examples could be found in examples dir.

Documentation

https://autozimu.github.io/Nanomsg.swift/