Skip to content

A ZeroMQ library created by our folks from Zewo. The original ->

License

Notifications You must be signed in to change notification settings

EVOlution-App/ZeroMQ

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ZeroMQKit

Swift Platform License

ZeroMQKit is a 0mq binding for Swift 4 and this repository is a fork of ZeroMQ.

Features

  • Context
  • Socket
  • Message
  • Poller
  • Proxy

Example

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!"
}

Installation

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")),
    ]
)

Support

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.

License

This project is released under the MIT license. See LICENSE for details.