Sha256: 27e85b9de3f53fc7acdf80ee89ba45f5093859fc550e432cc7f294713867fa0d
Contents?: true
Size: 544 Bytes
Versions: 3
Compression:
Stored size: 544 Bytes
Contents
require 'set' require 'power_strip/message' module PowerStrip class Channel attr_reader :name, :sockets def initialize(name, redis:) @name = name @redis = redis @sockets = Set.new end def << socket @sockets << socket end def delete socket @sockets.delete socket end def send event, message message = Message.new( channel: name, event: event, data: message ) @redis.publish :power_strip, message.to_json self end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
power_strip-0.1.2 | lib/power_strip/channel.rb |
power_strip-0.1.1 | lib/power_strip/channel.rb |
power_strip-0.1.0 | lib/power_strip/channel.rb |