Created
March 19, 2014 16:07
-
-
Save grimrose/9645102 to your computer and use it in GitHub Desktop.
Vert.xからfluent-plugin-websocketへ繋げる為のVert.x client #shibuyarb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
起動コマンド