ZeroMQKit is a 0mq binding for Swift 4 and this repository is a fork of ZeroMQ.
- Context
- Socket
- Message
- Poller
- Proxy
import ZeroMQKit
guard let context = try? Context() else {
fatalError("Context could not be instantiated")
}
guard let inbound = try? context.socket(.pull) else {
fatalError("Cannot create socket to .pull")
}
try? inbound.bind("tcp://127.0.0.1:5555")
if let outbound = try? context.socket(.push) {
try outbound.connect("tcp://127.0.0.1:5555")
_ = try outbound.send("Hello World!")
_ = try outbound.send("Bye!")
}
while let data = try? inbound.receive(), let value = data, value != "Bye!" {
print(value) // "Hello World!"
}
Install ZeroMQ system library
./setup_env.sh
Add ZeroMQ
to Package.swift
import PackageDescription
let package = Package(
dependencies: [
.package(url: "https://github.com/unnamedd/ZeroMQ.git", .upToNextMajor(from: "1.0.0")),
]
)
If you need any help you can join on Slack of Zewo and go to the #help channel. Or you can create a Github issue in our main repository. When stating your issue be sure to add enough details, specify what module is causing the problem and reproduction steps.
This project is released under the MIT license. See LICENSE for details.