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

tuppari

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tuppari

  • 0.1.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Tuppari client for Ruby

About Tuppari

Tuppari is an experimental implementation of unbreakable message broadcasting system using WebSocket and Amazon Web Services by @hakobera.

https://github.com/hakobera/tuppari

https://github.com/hakobera/tuppari-servers

Tuppari for Ruby developers

You can easily build a Tuppari application by just using Ruby API. Let's get started now!

Gemfile

Prepare Gemfile as follows.

source 'https://rubygems.org'

gem 'tuppari'

Getting Started

And then invoke bundle console to try Tuppari.

require 'tuppari'

Tuppari.create_account(YOUR_ID, PASSWORD)

tuppari = Tuppari.login(YOUR_ID, PASSWORD)

application = tuppari.create_application('first-tuppari')

open('tuppari.html', 'w') do |f|
  html = <<"EOF"
<html>
  <head>
  <script src="http://cdn.tuppari.com/0.2.0/tuppari.min.js"></script>
  <script>
    var client, channel;
    client = tuppari.createClient({applicationId: '#{application.id}'});
    channel = client.subscribe('ch');
    channel.bind('update', function (msg) {
      console.log(msg);
    });
  </script>
  </head>
  <body>Check JavaScript console.</body>
</html>
EOF
  f.write(html)
end

#
# [notice] Please open this 'tuppari.html' file in browser.
#

tuppari.application = application # or tuppari.load_application_by_name('first-tuppari') 

tuppari.publish_message(
  :channel => 'ch',
  :event => 'update',
  :message => "Hello, Tuppari! (#{Time.now})"
)

Publishing messages without account authentication

Tuppari account authentication is not needed for publishing messages. And following values for the target application are required.

  • application_id
  • access_key_id (for the application)
  • access_secret_key (for the application)
application = Tuppari::Application.new(
  :id                => '4032236d-699a-4599-9405-xxxxxxxxxxxx', 
  :access_key_id     => 'b49049f9-e055-4fa5-925b-xxxxxxxxxxxx', 
  :access_secret_key => 'c01a3a31-92cd-4bf9-a238-xxxxxxxxxxxx'
) # or application = tuppari.get_application('first-tuppari') 

Tuppari.publish_message(
  :application => application,
  :channel => 'ch',
  :event => 'update',
  :message => "Hello, Tuppari! (#{Time.now})"
)

FAQs

Package last updated on 15 Aug 2012

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