to the echo server!" end def receive_data data send_data ">>> you sent: #{data}" end end EventMachine::run do EventMachine::start_server "127.0.0.1", 8081, EchoServer puts 'running echo server on 8081' end Easy!
to the echo server!" end def receive_data data send_data ">>> you sent: #{data}" end end EventMachine::run do EventMachine::start_server "127.0.0.1", 8081, EchoServer puts 'running echo server on 8081' end Easy! Maybe Not
when :start_string then start_string when :unicode_escape then unicode_escape when :start_surrogate_pair then start_surrogate when :start_negative_number then start_negative when :start_zero then start_zero when :start_float then start_float when :start_exponent then start_exponent when :start_int then start_int when :start_true then start_true when :start_false then start_false when :start_null then start_null when :end_key then end_key when :start_array then start_array when :end_value then end_value when :end_document then end_document end JSON::Stream
:start_object @stack.push(:object) notify_start_document notify_start_object when "[" @state = :start_array @stack.push(:array) notify_start_document notify_start_array when WS # ignore else error("Expected object or array start") end when :start_object case ch JSON::Stream
node(node) raise StreamErrors::NotAuthorized unless stream?(node) stream.start(node) doc = Document.new features = doc.create_element('stream:features') do |el| el << doc.create_element('starttls') do |tls| tls.default_namespace = NAMESPACES[:tls] tls << doc.create_element('required') end end stream.write(features) advance end end