<commit_before>ruby-mqtt
=========

Pure Ruby gem that implements the MQTT (Message Queue Telemetry Transport) protocol, a lightweight protocol for publish/subscribe messaging.


Installing
----------

You may get the latest stable version from Rubyforge. Source gems are also available.

    $ gem install mqtt

Synopsis
--------

    require 'rubygems'
    require 'mqtt'
    
    # Publish example
    mqtt = MQTT::Client.new('mqtt.example.com')
    mqtt.connect do |c|
      c.publish('topic','message')
    end
    
    # Subscribe example
    mqtt = MQTT::Client.new('mqtt.example.com')
    client.connect do
      client.subscribe('test')
      loop do
        topic,message = client.get
        puts "#{topic}: #{message}"
      end
    end


TODO
----

* Implement Will and Testament
* Process acknowledgement packets / Implement QOS 1 in client
* More validations of data/parameters
* More error checking and exception throwing
  - Check that packet data is valid - don't blindly read values
  - Subscribe and Unsubscribe packets should always have QOS of 1
* More examples
* Integration tests
* Refactor to add callbacks that are called from seperate thread
* Implement QOS Level 2 in client
* Prevent proxy from connecting to itself
* Add support for binding socket to specific local address


Resources
---------

* MQTT Homepage: http://www.mqtt.org/
* GitHub Project: http://github.com/njh/ruby-mqtt
* Documentation: http://rdoc.info/github/njh/ruby-mqtt/master/frames


Contact
-------

* Author:    <NAME>
* Email:     <EMAIL>
* Home Page: http://www.aelius.com/njh/
* License:   Distributes under the same terms as Ruby<commit_msg>Updated README from mqtt to em-mqtt<commit_after>ruby-em-mqtt
============

This gem adds MQTT (Message Queue Telemetry Transport) protocol support to EventMachine,
an event-processing library for Ruby.


Installing
----------

You may get the latest stable version from rubygems.org:

    $ gem install em-mqtt
    
It depends upon the mqtt gem to perform packet parsing and serialising.


Synopsis
--------

    require 'rubygems'
    require 'em-mqtt'
    
    # Publish example
    EventMachine.run do
      c = ClientConnection.connect('test.mosquitto.org')
      EventMachine::PeriodicTimer.new(1.0) do
        puts "-- Publishing time"
        c.publish('test', "The time is #{Time.now}")
      end
    end

    
    # Subscribe example
    class MyConnection < EventMachine::MQTT::ClientConnection
      def receive_msg(packet)
        p packet
      end
    end
    
    EventMachine.run do
      MyConnection.connect('test.mosquitto.org') do |c|
        c.subscribe('test')
      end
    end


Resources
---------

* MQTT Homepage: http://www.mqtt.org/
* GitHub Project: http://github.com/njh/ruby-em-mqtt
* Documentation: http://rubydoc.info/gems/em-mqtt/frames


Contact
-------

* Author:    <NAME>
* Email:     <EMAIL>
* Home Page: http://www.aelius.com/njh/
* License:   Distributes under the same terms as Ruby
{'fraction_non_alphanumeric': 0.11663865546218487, 'fraction_numerical': 0.0016806722689075631, 'mean_word_length': 2.7766497461928936, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6752958', 'n_tokens_mistral': 922, 'n_tokens_neox': 880, 'n_words': 284}