New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

polytalk

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polytalk

  • 0.0.2
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Polytalk

Polytalk is a simple protocol which allows communication between different languages via TCP.

Polytalk currently supports PHP, Node.js and Ruby.

Protocol

The protocol is a simple language agnostic JSON object containing the class, method and arguments. It will then return an response as either a string or JSON object.

Key          Value
class        The class to call the method on. Namespaced classes require the :: separator.
method       The method you want to call.
arguments    The arguments to inject into the method in key value pairs.

Installation

Add this line to your application's Gemfile:

gem 'polytalk'

And then execute:

$ bundle

Or install it yourself as:

$ gem install polytalk

Server Example

Be sure that any classes you want to be exposed by the server to the client are included/required from the server.

server = Polytalk::Server.new({ port: 9090 })
server.run do |connection, request|
  response = server.call(request)
  server.push(connection, response)
end

Client Example

request = {
    class: 'Model::Order',
    method: 'findBySize',
    arguments: {
      size: 'large',
      limit: 3
    }
}

client = Polytalk::Client.new({ port: 9090 })

puts client.call(request)

# Passing a block
first = client.call(request) do |r|
  r.first
end
puts first

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

License

MIT, see LICENSE.

FAQs

Package last updated on 08 Dec 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