Skip to content

Commit

Permalink
Merge pull request #3 from stekker/connection-data-instead-of-rm-id
Browse files Browse the repository at this point in the history
Rename rm_id to context
  • Loading branch information
martijnversluis authored Sep 12, 2024
2 parents b553ec3 + 16c0afa commit 3a78a3a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/s2/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ def initialize(ws, logger: Rails.logger)
@ws = ws
@logger = logger
@sent_messages = {}
@rm_id = nil
@context = nil

update_state :connected
end

def open(rm_id)
@rm_id = rm_id
trigger_on_open(rm_id)
def open(context)
@context = context
trigger_on_open(context)
end

def receive_message(message_json)
trigger_before_receive(@rm_id, message_json)
trigger_before_receive(@context, message_json)
@logger.info("Received message: #{message_json}")

message = deserialize_message(message_json)
Expand All @@ -45,7 +45,7 @@ def send_message(message_class, payload)
store_sent_message(message) unless message.is_a?(S2::Messages::ReceptionStatus)
json = message.to_json
send_raw_message(json)
trigger_after_send(@rm_id, json)
trigger_after_send(@context, json)

@logger.info("Sent message: #{json}")
end
Expand Down

0 comments on commit 3a78a3a

Please sign in to comment.