Skip to content

Instantly share code, notes, and snippets.

View amclain's full-sized avatar

Alex McLain amclain

View GitHub Profile
# require 'ffi-rzmq'
require 'zeromqrb'
# socket_path = 'tcp://127.0.0.1:5050'
socket_path = 'ipc://zmq_hello_world.ipc'
# ctx = ZMQ::Context.create
ctx = ZeroMQ::Context.new
# Server
require 'ffi-rzmq'
require 'timeout'
# socket_path = 'tcp://127.0.0.1:5050'
# socket_path = 'ipc://zmq_pub_sub.ipc'
socket_path = 'epgm://eth0;239.0.0.1:5050'
ctx = ZMQ::Context.create
# Subscriber
# Convert an object to JSON, push it over MQTT,
# and reconstruct the object.
require 'mqtt'
require 'json'
# ip = '192.168.0.61'
ip = '10.0.1.27'
send = OpenStruct.new val_1:123, val_2:456
require 'ffi-rzmq'
require 'timeout'
socket_path = 'tcp://127.0.0.1:5050'
# socket_path = 'ipc://zmq_pub_sub.ipc'
ctx = ZMQ::Context.create
# Subscriber
sub_thread = Thread.new do
require 'ffi-rzmq'
require 'timeout'
socket_path = 'tcp://127.0.0.1:5050'
# socket_path = 'ipc://zmq_pub_sub.ipc'
ctx = ZMQ::Context.create
# Subscriber
sub_thread = Thread.new do
require 'ffi-rzmq'
# socket_path = 'tcp://127.0.0.1:5050'
socket_path = 'ipc://zmq_hello_world.ipc'
ctx = ZMQ::Context.create
# Server
thread = Thread.new do
rep_sock = ctx.socket ZMQ::REP