Sha256: 94ac3831769f78968ad2891497250be97cbe4f19b0bf474cf5a0d32e8640c7dd
Contents?: true
Size: 848 Bytes
Versions: 7
Compression:
Stored size: 848 Bytes
Contents
module Baleen class Connection def initialize(socket=nil) @socket = socket end def notify_info(msg) notify_to_client(msg, "info") end def notify_warn(msg) notify_to_client(msg, "warn") end def notify_error(msg) notify_to_client(msg, "error") end def respond(response) write(response.to_json) end def close @socket.close end def notify_exception(msg) response = Baleen::Message::Exception.new({:message => msg}) write(response.to_json) end private def notify_to_client(msg, level) response = Baleen::Message::ToClient.new({:message => msg, :level => level}) write(response.to_json) end def write(json_data) if @socket @socket.puts(json_data) else nil end end end end
Version data entries
7 entries across 7 versions & 1 rubygems