From 2bfa33874ebf95ef383bdd144519633c28e122d1 Mon Sep 17 00:00:00 2001 From: "G. Gibson" Date: Fri, 5 Sep 2025 17:43:55 -0700 Subject: [PATCH] federation fixes --- gxg-framework.gemspec | 2 +- lib/gxg/gxg_events.rb | 17 +++++++++++------ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/gxg-framework.gemspec b/gxg-framework.gemspec index 9374f58..b002193 100644 --- a/gxg-framework.gemspec +++ b/gxg-framework.gemspec @@ -1,6 +1,6 @@ Gem::Specification.new do |s| s.name = 'gxg-framework' - s.version = '0.0.63' + s.version = '0.0.64' s.licenses = ['HIPPOCRATIC 2.1', 'https://firstdonoharm.dev/version/2/1/license.html'] s.summary = "GxG Framework" s.description = "GxG Framework" diff --git a/lib/gxg/gxg_events.rb b/lib/gxg/gxg_events.rb index fcb7dab..54d8952 100644 --- a/lib/gxg/gxg_events.rb +++ b/lib/gxg/gxg_events.rb @@ -16,7 +16,7 @@ module GxG module Messages class Channel # - def initialize(the_uuid) + def initialize(the_uuid=nil, the_object=nil) @uuid = the_uuid @inbox = [] @inbox_safety = ::Mutex.new @@ -25,6 +25,7 @@ module GxG @socket = nil @remote = nil @channel_secret = nil + @object = the_object self end # @@ -32,6 +33,10 @@ module GxG @uuid end # + def object() + @object + end + # def socket() @socket end @@ -148,8 +153,8 @@ module GxG GXG_FEDERATION_SAFETY.synchronize { GXG_FEDERATION[:connections][(the_uuid)] } end # - def create_channel(the_uuid) - GXG_FEDERATION_SAFETY.synchronize { GXG_FEDERATION[:connections][(the_uuid)] = ::GxG::Messages::Channel.new(the_uuid)} + def create_channel(the_uuid=nil, the_object=nil) + GXG_FEDERATION_SAFETY.synchronize { GXG_FEDERATION[:connections][(the_uuid)] = ::GxG::Messages::Channel.new(the_uuid,the_object)} end # def destroy_channel(the_uuid) @@ -999,7 +1004,7 @@ class Object def send_message(the_message) unless @uuid @uuid = ::GxG::uuid_generate.to_s.to_sym - ::GxG::CHANNELS.create_channel(@uuid) + ::GxG::CHANNELS.create_channel(@uuid,self) end ::GxG::CHANNELS.send_message(@uuid, the_message) true @@ -1008,7 +1013,7 @@ class Object def next_message() unless @uuid @uuid = ::GxG::uuid_generate.to_s.to_sym - ::GxG::CHANNELS.create_channel(@uuid) + ::GxG::CHANNELS.create_channel(@uuid,self) end ::GxG::CHANNELS.next_message(@uuid) end @@ -1016,7 +1021,7 @@ class Object def post(the_message) unless @uuid @uuid = ::GxG::uuid_generate.to_s.to_sym - ::GxG::CHANNELS.create_channel(@uuid) + ::GxG::CHANNELS.create_channel(@uuid,self) end channel = ::GxG::CHANNELS.fetch_channel(@uuid) if channel