Skip to content
No description or website provided.
Ruby Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
test
.gitignore
CHANGELOG.md
Gemfile
Gemfile.lock
LICENSE
README.md
Rakefile
client.rb
justfile
rsocket-rb.gemspec
server.rb

README.md

rsocket-rb

Ruby implementation of RSocket

Installation

Add this line to your application's Gemfile:

gem 'rsocket-rb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rsocket-rb

How to use?

  • RSocket Server with Sinatra style
require 'rsocket/server_bootstrap'
require 'rsocket/payload'
require 'rx'

set :schema, 'tcp'
set :port, 42252

# @param payload [RSocket::Payload]
#@return [Rx::Observable]
def request_response(payload)
  puts "request/response called"
  Rx::Observable.just(payload_of("data", "metadata"))
end
  • RSocket Client
require 'rubygems'
require 'eventmachine'
require 'rsocket/requester'
require 'rsocket/payload'
require 'rx'


EventMachine.run {
  #rsocket = EventMachine.connect '127.0.0.1', 1235, AppRequester
  rsocket = RSocket.connect("tcp://127.0.0.1:42252")
  rsocket.request_response(payload_of("request", "response"))
      .subscribe(Rx::Observer.configure do |observer|
        observer.on_next { |payload| puts payload.data_utf8 }
        observer.on_completed { puts "completed" }
        observer.on_error { |error| puts error }
      end)

}

Todo

Transport

  • TCP
  • Websocket: em-websocket

Duplex Socket

  • MetadataPush
  • RequestFNF
  • RequestResponse
  • RequestStream
  • RequestChannel
Others
  • Composite Metadata
  • TCK Test
  • Timeout support
  • Resume
  • Keepalive
  • Fragmentation
  • Cancel
  • Error
  • Flow Control: RequestN
  • Flow Control: Lease
  • Load Balance

References

You can’t perform that action at this time.