Ruby implementation of RSocket
Add this line to your application's Gemfile:
gem 'rsocket-rb'
And then execute:
$ bundle
Or install it yourself as:
$ gem install rsocket-rb
- 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)
}
- TCP
- Websocket: em-websocket
- MetadataPush
- RequestFNF
- RequestResponse
- RequestStream
- RequestChannel
- Composite Metadata
- TCK Test
- Timeout support
- Resume
- Keepalive
- Fragmentation
- Cancel
- Error
- Flow Control: RequestN
- Flow Control: Lease
- Load Balance
- RSocket Home: http://rsocket.io/
- EventMachine: fast, simple event-processing library for Ruby programs https://github.com/eventmachine/eventmachine
- RxRuby: https://github.com/ReactiveX/RxRuby