Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gmsec

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gmsec

  • 0.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

GMSEC for Ruby

This is a Ruby library that wraps the GMSEC API in a Ruby-friendly way. This makes it easy to quickly develop applications that can be deployed in a ground system environment that leverages the various software libraries in the Ruby community.

Installation

You will need to compile and install GMSEC 3.6 according to GMSEC documentation. Ensure that the GMSEC and supporting libraries (Bolt, MBServer, etc) are available in a standard library location such as /usr/local/lib. If on Windows, make sure that your PATH variable includes the location of where the GMSEC library exists.

After that, simply run: gem install gmsec to install this gem!

Example Usage

require 'gmsec'

# Create a connection by passing configuration options.
connection = GMSEC::Connection.new(connectiontype: :gmsec_mb)

# Connect based on connection defaults, i.e., localhost.
connection.connect

connection.connected? # Return true

connection.subscribe("TEST.*") do |message|
  # Print the message
  puts message.to_s
end

# Start auto dispatching so that the above subscription will be automatically kicked off
# when a message is received.
connection.start_auto_dispatch

# Create a new message using connection defaults.
message = connection.new_message

# We can add fields to messages using bracket notation:
message[:foo] = :bar

# We can append hashes to a message, creating multiple fields at once:
message << {answer: 42, baz: true}

# Or we can explicitly create a GMSEC Field object where we specify the data type:
message << GMSEC::Field.new(:bar, "x", type: :char)

message.subject = "TEST.FOO"

# Publish the message.
connection.publish(message)

# We should see:
#
# +---------------+------------------------------------------+
# |                         TEST.FOO                         |
# +---------------+------------------------------------------+
# | CONNECTION-ID | 2                                        |
# | MW-INFO       | gmsec_mb: localhost                      |
# | NODE          | xxxxx_local                              |
# | PROCESS-ID    | 64047                                    |
# | PUBLISH-TIME  | 2014-363-00:53:45.604                    |
# | UNIQUE-ID     | GMSEC_XXXXX_LOCAL_54A0A61980A4_64047_2_1 |
# | USER-NAME     | user                                     |
# | answer        | 42                                       |
# | bar           | x                                        |
# | baz           | true                                     |
# | foo           | bar                                      |
# +---------------+------------------------------------------+

# We can also publish messages easily without having to create `Message` instances:
connection.publish({foo: :bar, answer: 42, baz: true}, subject: "TEST.BAZ")

FAQs

Package last updated on 29 Dec 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc