Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
15 changes: 11 additions & 4 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
---
version: "6.0.1"
version: "6.0.2"
changelog:
- date: 2026-03-03
version: v6.0.2
changes:
- type: improvement
text: "Add `.uniq` calls when building subscribe URL path and channel-group query parameter to prevent duplicate channels and channel groups from leaking into HTTP requests."
- type: improvement
text: "Add `.uniq` calls when building heartbeat URL path and channel-group query parameter to prevent duplicate channels and channel groups from leaking into HTTP requests."
- date: 2025-11-04
version: v6.0.1
changes:
Expand Down Expand Up @@ -627,7 +634,7 @@ sdks:
- x86-64
- distribution-type: package
distribution-repository: RubyGems
package-name: pubnub-6.0.1.gem
package-name: pubnub-6.0.2.gem
location: https://rubygems.org/gems/pubnub
requires:
- name: addressable
Expand Down Expand Up @@ -732,8 +739,8 @@ sdks:
- x86-64
- distribution-type: library
distribution-repository: GitHub release
package-name: pubnub-6.0.1.gem
location: https://github.com/pubnub/ruby/releases/download/v6.0.1/pubnub-6.0.1.gem
package-name: pubnub-6.0.2.gem
location: https://github.com/pubnub/ruby/releases/download/v6.0.2/pubnub-6.0.2.gem
requires:
- name: addressable
min-version: 2.0.0
Expand Down
77 changes: 42 additions & 35 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,45 @@
## v6.0.1
November 04 2025

#### Fixed
- Send proper object for `state` with the `heartbeat` request.

#### Modified
- Don't cap `limit` and let the server perform value validation.
- Replace legacy timetoken query parameter with subscribe v2 parameters.

## v6.0.0
October 15 2025

#### Added
- BREAKING CHANGES: Add 'limit' and 'offset' parameters for 'here_now' for pagination support.

## v5.6.0
September 11 2025

#### Added
- Add the `encode_channels` parameter for `fetch` to enable or disable channel names percent-encoding in response.

## v5.5.1
September 08 2025

#### Fixed
- Fix the issue introduced by RuboCop linter suggestion acceptance, which caused a wrong number of arguments error.

## v5.5.0
January 28 2025

#### Added
- Add the ability to specify `type` and `status` fields for `channel metadata`, `uuid metadata`, `member`, and `membership`.
- Add missing `include` options for App Context APIs: `custom`, `status`, `type`, `uuid_status`, `uuid_type`, `channel_status`, and `channel_type`.

## v6.0.2
March 03 2026

#### Modified
- Add `.uniq` calls when building subscribe URL path and channel-group query parameter to prevent duplicate channels and channel groups from leaking into HTTP requests.
- Add `.uniq` calls when building heartbeat URL path and channel-group query parameter to prevent duplicate channels and channel groups from leaking into HTTP requests.

## v6.0.1
November 04 2025

#### Fixed
- Send proper object for `state` with the `heartbeat` request.

#### Modified
- Don't cap `limit` and let the server perform value validation.
- Replace legacy timetoken query parameter with subscribe v2 parameters.

## v6.0.0
October 15 2025

#### Added
- BREAKING CHANGES: Add 'limit' and 'offset' parameters for 'here_now' for pagination support.

## v5.6.0
September 11 2025

#### Added
- Add the `encode_channels` parameter for `fetch` to enable or disable channel names percent-encoding in response.

## v5.5.1
September 08 2025

#### Fixed
- Fix the issue introduced by RuboCop linter suggestion acceptance, which caused a wrong number of arguments error.

## v5.5.0
January 28 2025

#### Added
- Add the ability to specify `type` and `status` fields for `channel metadata`, `uuid metadata`, `member`, and `membership`.
- Add missing `include` options for App Context APIs: `custom`, `status`, `type`, `uuid_status`, `uuid_type`, `channel_status`, and `channel_type`.

## v5.4.0
January 07 2025

Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
pubnub (6.0.1)
pubnub (6.0.2)
addressable (>= 2.0.0)
concurrent-ruby (~> 1.3.4)
concurrent-ruby-edge (~> 0.7.1)
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
6.0.1
6.0.2
4 changes: 2 additions & 2 deletions fixtures/vcr_cassettes/examples/presence/0.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions fixtures/vcr_cassettes/examples/presence/1.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions fixtures/vcr_cassettes/examples/presence/2.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 46 additions & 0 deletions fixtures/vcr_cassettes/lib/events/heartbeat-unique.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions lib/pubnub/events/heartbeat.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def path
'sub-key',
@subscribe_key,
'channel',
Formatter.channels_for_url(@channel),
Formatter.channels_for_url(@channel.uniq),
'heartbeat'
].join('/')
end
Expand All @@ -37,7 +37,7 @@ def parameters(*_args)
parameters.delete(:state) if parameters[:state] == '%7B%7D'
end
parameters[:heartbeat] = @heartbeat
parameters['channel-group'] = @group.join(',') unless @group.blank?
parameters['channel-group'] = @group.uniq.join(',') unless @group.blank?
parameters
end

Expand Down
4 changes: 2 additions & 2 deletions lib/pubnub/subscribe_event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def path
'v2',
'subscribe',
@subscribe_key,
Pubnub::Formatter.channels_for_url(@channel + @wildcard_channel),
Pubnub::Formatter.channels_for_url((@channel + @wildcard_channel).uniq),
0
].join('/').gsub(/\?/, '%3F')
end
Expand All @@ -151,7 +151,7 @@ def add_timetoken_to_params(params)
end

def add_group_to_params(params)
params['channel-group'] = @group.join(',') unless @group.empty?
params['channel-group'] = @group.uniq.join(',') unless @group.empty?
params
end

Expand Down
2 changes: 1 addition & 1 deletion lib/pubnub/version.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Toplevel Pubnub module.
module Pubnub
VERSION = '6.0.1'.freeze
VERSION = '6.0.2'.freeze
end
13 changes: 13 additions & 0 deletions spec/lib/events/heartbeat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@
end
end

it "sends unique channels and channel groups even when duplicates are provided" do
VCR.use_cassette("lib/events/heartbeat-unique", record: :once) do
envelope = @pubnub.heartbeat(
channel: ['demo', 'demo', 'demo-b'],
channel_group: ['grp-a', 'grp-a'],
).value

expect(envelope.status[:client_request].to_s).to include('/channel/demo,demo-b/')
expect(envelope.status[:client_request].to_s).to include('channel-group=grp-a')
expect(envelope.status[:client_request].to_s).not_to include('channel-group=grp-a,grp-a')
end
end

it "forms valid ErrorEnvelope on error" do
VCR.use_cassette("lib/events/heartbeat-error", record: :once) do
envelope = @pubnub.heartbeat(
Expand Down
Loading