This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder