Sha256: 7b7b6d0d524f74ac8eabefede3c7336ee90a321bcc136a85234bed3666f568d9
Contents?: true
Size: 1.16 KB
Versions: 3
Compression:
Stored size: 1.16 KB
Contents
require 'json' module XRefreshServer # client representation on server side class Client attr_accessor :id, :dead, :type, :agent def initialize(id, socket) @id = id @socket = socket @dead = false @type = '?' @agent = '?' end def name green("#{@type}(#{@id})") end def send(data) return if @dead begin @socket << data.to_json rescue OUT.puts "Client #{name} #{red("is dead")}" @dead = true end end def send_about(version, agent) send({ "command" => "AboutMe", "version" => version, "agent" => agent }) end def send_do_refresh(root, name, type, date, time, files) send({ "command" => "DoRefresh", "root" => root, "name" => name, "date" => date, "time" => time, "type" => type, "files" => files }) end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
darwin-xrefresh-server-0.1.5 | lib/xrefresh-server/client.rb |
xrefresh-server-0.1.6 | lib/xrefresh-server/client.rb |
xrefresh-server-0.1.7 | lib/xrefresh-server/client.rb |