Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ECO-4058] Feature/Integration protocol 2 #423

Merged
merged 62 commits into from
Jul 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
301d73d
removed unnecessary connection serial references from the code
sacOO7 Jun 2, 2024
67dee1d
removed connection serial references from connection file
sacOO7 Jun 2, 2024
58fb431
Refactored comments related to connection serial, removed comments me…
sacOO7 Jun 5, 2024
aaa6211
removed unnecessary has_connection_serial, has_serial method and rela…
sacOO7 Jun 5, 2024
832d9c4
removed connection_serial property from protocol_message, removed all
sacOO7 Jun 5, 2024
d4b2e6c
Updated ably protocol version to 2, updated relevant tests
sacOO7 Jun 6, 2024
21279fa
Renamed VERSION constant to LIB_VERSION for readability
sacOO7 Jun 6, 2024
efb7dad
Set idempotent rest publishing to true by default, updated relevant t…
sacOO7 Jun 6, 2024
4b448ff
Added RecoveryKeyContext class and unit tests for the same
sacOO7 Jun 6, 2024
7b8af6b
Fixed typos in ruby docs for internal modules and realtime channel class
sacOO7 Jun 6, 2024
a0114b9
Added channelSerial field to channel properties, implemented following
sacOO7 Jun 6, 2024
4ba3917
Implemented create_recovery_key method on connection. Implemented
sacOO7 Jun 6, 2024
c0760d6
Fix file location: Moved recovery_key_context from test to lib
sacOO7 Jun 6, 2024
9dbe92c
renamed in_sync enum to sync_complete, updated as per spec
sacOO7 Jun 6, 2024
5b0a006
Implemented onAttach channel presence
sacOO7 Jun 6, 2024
b0ad4fb
Revert "Renamed VERSION constant to LIB_VERSION for readability"
sacOO7 Jun 21, 2024
c4ff9e5
Refactored idempotent publishing test name to be enabled by default
sacOO7 Jun 21, 2024
b1789fa
removed nil check for protocol_message while setting channel serial
sacOO7 Jun 21, 2024
54e186d
channel_name accessor made explicit for better readability
sacOO7 Jun 21, 2024
15b21d7
returning nil for create_recovery_key, same as old deprecated recover…
sacOO7 Jun 21, 2024
32e68cf
Added AblyExtensions for empty/nil string check, updated usages for the
sacOO7 Jun 24, 2024
7a04abc
Updated invalid check impl on protocol_message received
sacOO7 Jun 24, 2024
a3d9746
Refactored logic for sending ATTACH message
sacOO7 Jun 24, 2024
4022ab8
Removed unused references to resume_callbacks used for client initiat…
sacOO7 Jun 24, 2024
c328c6c
Fixed impl for creating presence message using id
sacOO7 Jun 24, 2024
e77e6ba
Added missing spec annotations for presence_manager
sacOO7 Jun 24, 2024
82ae801
Merge branch 'feature/protocol-2-resume-recover' into feature/protoco…
sacOO7 Jun 25, 2024
f4d7f2b
[ECO-4845] refactored rest/realtime auth
sacOO7 Jun 25, 2024
bb4b71f
Fixed naming convention for client_id_header as per review comment
sacOO7 Jun 25, 2024
c10e485
Removed unncessary use of auth clientId while entering presence local…
sacOO7 Jun 25, 2024
0f49ede
renamed auth client_id_header to external_client_id
sacOO7 Jun 25, 2024
446a16f
Marked enter_local_members public instead of private
sacOO7 Jun 25, 2024
b32bb57
Fixed test that updated attach_serial everytime new attach msg is rec…
sacOO7 Jul 2, 2024
1324a72
replaced next unless with assertive if condition for op retry on reco…
sacOO7 Jul 2, 2024
8b9b556
Refactored implementation for sending ATTACH and DETACH message
sacOO7 Jul 2, 2024
317572b
Merge pull request #409 from ably/feature/protocol-2-resume-recover
sacOO7 Jul 3, 2024
cbdf545
Merge pull request #410 from ably/feature/protocol-2-presence
sacOO7 Jul 3, 2024
1c8f52f
refactored updated attach_serial test as per review comment
sacOO7 Jul 3, 2024
1ff7d6b
Added separate method client_id_for_request that returns client_id
sacOO7 Jul 3, 2024
91e5f29
Revert "Removed unncessary use of auth clientId while entering presen…
sacOO7 Jul 3, 2024
c8745a4
Removed unncessary channel publish from the attach_serial test
sacOO7 Jul 3, 2024
7be9e8c
Removed unncessary use of auth clientId while entering presence local…
sacOO7 Jul 3, 2024
2eba50f
Refactored channel attach, removed check for forced attach
sacOO7 Jul 3, 2024
7a973ae
Refactored send_protocol_message method, removed unnecessary usage of…
sacOO7 Jul 3, 2024
d37be2f
Synced protocol-2-presence changes
sacOO7 Jul 4, 2024
07aadbd
Updated channel_manager,
sacOO7 Jul 4, 2024
47c55d7
Added test to check for duplicate attach message sent or received
sacOO7 Jul 4, 2024
9981082
Merge pull request #416 from ably/fix/duplicate-attach-msg-send
sacOO7 Jul 4, 2024
af7bde9
Merge pull request #421 from ably/fix/until_attach_serial_test
sacOO7 Jul 4, 2024
08877bf
Merge pull request #418 from ably/fix/wildcard-clientId-request
sacOO7 Jul 4, 2024
e164a90
Merge branch 'main' into feature/integration-protocol-2
sacOO7 Jul 5, 2024
d22b3e7
Fixed logger msg for queuing outgoing msg in realtime#connection
sacOO7 Jul 5, 2024
b8231d8
Removed unnecessary on_resume flag from channels_spec
sacOO7 Jul 5, 2024
8300ecd
[Protocol 2] Fixed tests for realtime/channel_spec
sacOO7 Jul 5, 2024
fc69791
[Protocol 2] Fixed tests for realtime/connection_failures_spec
sacOO7 Jul 5, 2024
771ed34
[Protocol 2] Fixed tests for realtime/connection_spec
sacOO7 Jul 5, 2024
949808e
[Protocol 2] Fixed tests for realtime/message_spec
sacOO7 Jul 5, 2024
3686c27
[Protocol 2] Fixed/added tests for realtime/presence_spec
sacOO7 Jul 5, 2024
73beeec
[Protocol 2] Skipped test because of irregularities with respect to spec
sacOO7 Jul 5, 2024
ef7be90
Fixed typo for unit test, replaced auth_connect with auto_connect
sacOO7 Jul 5, 2024
e3eb351
Added comment on skipped tests describing reason for skipping them
sacOO7 Jul 5, 2024
3e1882e
Merge pull request #426 from ably/feature/integration-protocol-2-tests
sacOO7 Jul 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed connection_serial property from protocol_message, removed all
related tests for the same
sacOO7 committed Jun 5, 2024
commit 832d9c43b81dd4c0eae95cf5829d16ccc5906140
6 changes: 0 additions & 6 deletions lib/ably/models/protocol_message.rb
Original file line number Diff line number Diff line change
@@ -127,12 +127,6 @@ def message_serial
raise TypeError, "msg_serial '#{attributes[:msg_serial]}' is invalid, a positive Integer is expected for a ProtocolMessage"
end

def connection_serial
Integer(attributes[:connection_serial])
rescue TypeError
raise TypeError, "connection_serial '#{attributes[:connection_serial]}' is invalid, a positive Integer is expected for a ProtocolMessage"
end

def count
[1, attributes[:count].to_i].max
end
6 changes: 3 additions & 3 deletions lib/ably/realtime/connection.rb
Original file line number Diff line number Diff line change
@@ -330,7 +330,7 @@ def internet_up?
# @return [String]
#
def recovery_key
"already implemented"
"will be implemented"
end

# Following a new connection being made, when connection key is sent
@@ -454,9 +454,9 @@ def create_websocket_transport
url_params.merge!(client.transport_params)

if connection_resumable?
puts "this is already implemented as per spec"
puts "this is will be implemented as per spec"
elsif connection_recoverable?
puts "this is already implemented as per spec"
puts "this is will be implemented as per spec"
logger.debug { "Recovering connection with key #{client.recover}" }
unsafe_once(:connected, :closed, :failed) do
client.disable_automatic_connection_recovery
6 changes: 3 additions & 3 deletions lib/ably/realtime/connection/connection_manager.rb
Original file line number Diff line number Diff line change
@@ -127,7 +127,7 @@ def connected(protocol_message)

reattach_suspended_channels protocol_message.error

connection.configure_new protocol_message.connection_id, protocol_message.connection_details.connection_key, protocol_message.connection_serial
connection.configure_new protocol_message.connection_id, protocol_message.connection_details.connection_key
end

# When connection is CONNECTED and receives an update
@@ -139,7 +139,7 @@ def connected_update(protocol_message)
# Update the connection details and any associated defaults
connection.set_connection_details protocol_message.connection_details

connection.configure_new protocol_message.connection_id, protocol_message.connection_details.connection_key, protocol_message.connection_serial
connection.configure_new protocol_message.connection_id, protocol_message.connection_details.connection_key

state_change = Ably::Models::ConnectionStateChange.new(
current: connection.state,
@@ -281,7 +281,7 @@ def retry_count_for_state(state)
# Any message sent before an ACK/NACK was received on the previous transport
# need to be resent to the Ably service so that a subsequent ACK/NACK is received.
# It is up to Ably to ensure that duplicate messages are not retransmitted on the channel
# base on the serial numbers
# based on the message serial numbers
#
# @api private
def resend_pending_message_ack_queue
4 changes: 0 additions & 4 deletions spec/acceptance/realtime/connection_spec.rb
Original file line number Diff line number Diff line change
@@ -870,7 +870,6 @@ def log_connection_changes
let(:protocol_message_attributes) do
{
action: Ably::Models::ProtocolMessage::ACTION.Connected.to_i,
connection_serial: 55,
connection_details: {
max_idle_interval: 2 * 1000
}
@@ -1180,7 +1179,6 @@ def log_connection_changes
let(:protocol_message_attributes) do
{
action: Ably::Models::ProtocolMessage::ACTION.Connected.to_i,
connection_serial: 55,
connection_details: {
max_idle_interval: 2 * 1000
}
@@ -1921,7 +1919,6 @@ def self.available_states
let(:protocol_message_attributes) do
{
action: Ably::Models::ProtocolMessage::ACTION.Connected.to_i,
connection_serial: 55,
connection_details: {
client_id: 'bob',
connection_key: connection_key,
@@ -1979,7 +1976,6 @@ def self.available_states
let(:protocol_message_attributes) do
{
action: Ably::Models::ProtocolMessage::ACTION.Connected.to_i,
connection_serial: 22,
error: { code: 50000, message: 'Internal failure' },
}
end
5 changes: 0 additions & 5 deletions spec/acceptance/realtime/presence_spec.rb
Original file line number Diff line number Diff line change
@@ -580,7 +580,6 @@ def presence_action(method_name, data)
action = Ably::Models::ProtocolMessage::ACTION.Presence
presence_msg = Ably::Models::ProtocolMessage.new(
action: action,
connection_serial: 20,
channel: channel_name,
presence: presence_data,
timestamp: Time.now.to_i * 1000
@@ -2241,7 +2240,6 @@ def connect_members_deferrables
action = Ably::Models::ProtocolMessage::ACTION.Sync
sync_message = Ably::Models::ProtocolMessage.new(
action: action,
connection_serial: 10,
channel_serial: 'sequenceid:cursor',
channel: channel_name,
presence: presence_sync_1,
@@ -2251,7 +2249,6 @@ def connect_members_deferrables

sync_message = Ably::Models::ProtocolMessage.new(
action: action,
connection_serial: 11,
channel_serial: 'sequenceid:', # indicates SYNC is complete
channel: channel_name,
presence: presence_sync_2,
@@ -2292,7 +2289,6 @@ def connect_members_deferrables
action = Ably::Models::ProtocolMessage::ACTION.Sync
sync_message = Ably::Models::ProtocolMessage.new(
action: action,
connection_serial: 10,
channel: channel_name,
presence: presence_sync,
timestamp: Time.now.to_i * 1000
@@ -2346,7 +2342,6 @@ def connect_members_deferrables
action = Ably::Models::ProtocolMessage::ACTION.Sync
sync_message = Ably::Models::ProtocolMessage.new(
action: action,
connection_serial: 10,
channel: channel_name,
presence: presence_sync_protocol_message,
timestamp: Time.now.to_i * 1000
8 changes: 0 additions & 8 deletions spec/unit/models/protocol_message_spec.rb
Original file line number Diff line number Diff line change
@@ -127,14 +127,6 @@ def new_protocol_message(options)
end
end

context '#connection_serial' do
let(:protocol_message) { new_protocol_message(connection_serial: "55") }
it 'converts :connection_serial to an Integer' do
expect(protocol_message.connection_serial).to be_a(Integer)
expect(protocol_message.connection_serial).to eql(55)
end
end

context '#flags (#TR4i)' do
context 'when nil' do
let(:protocol_message) { new_protocol_message({}) }