Skip to content

Instantly share code, notes, and snippets.

@grimrose
Created March 19, 2014 16:07
Show Gist options
  • Save grimrose/9645102 to your computer and use it in GitHub Desktop.
Save grimrose/9645102 to your computer and use it in GitHub Desktop.
Vert.xからfluent-plugin-websocketへ繋げる為のVert.x client #shibuyarb
require "vertx"
client = Vertx::HttpClient.new
client.host = 'localhost'
client.port = 9000
client.connect_web_socket('/') do |websocket|
websocket.data_handler do |buffer|
puts "received: #{buffer}"
res ={:status => 'ok', :data => buffer}
Vertx::EventBus.send('subscriber', res)
end
end
Vertx::EventBus.register_handler('subscriber') do |message|
puts "subscriber: #{message.body}"
message.reply('reply!')
end
puts 'client start'
@grimrose
Copy link
Author

起動コマンド

$ vertx run vertx_client.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment