Skip to content

rsocket/rsocket-rb

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

About

No description or website provided.

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published