Sha256: 68c30ff0bc648563ca156d99f27275e946fbf53b9951fd49b569ff90aec9b592
Contents?: true
Size: 659 Bytes
Versions: 9
Compression:
Stored size: 659 Bytes
Contents
## # This class provides methods for EventSource connection instance. # @attr [EM::Connection] connection the connection instance of EventMachine class Midori::EventSource attr_accessor :connection # @param [EM::Connection] connection the connection instance of EventMachine def initialize(connection) @connection = connection end # Send data and close the connection # @param [String] data data to be sent def send(data) raise Midori::Exception::EventSourceTypeError unless data.is_a? String @connection.send_data(data.split("\n").map {|str| "data: #{str}\n"}.join + "\n") @connection.close_connection_after_writing end end
Version data entries
9 entries across 9 versions & 1 rubygems