Skip to content

Commit

Permalink
Merge pull request #182 from pusher/fix-publish-limit
Browse files Browse the repository at this point in the history
fix the channels limit for  a single publish
  • Loading branch information
benw-pusher authored Aug 19, 2022
2 parents 08af7fb + 8c97aee commit 18109ec
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 2.0.3

* [FIXED] Corrected the channels limit when publishing events. Upped from 10 to 100.

## 2.0.2

* [CHANGED] made encryption_master_key_base64 globally configurable
Expand Down
2 changes: 1 addition & 1 deletion lib/pusher/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def em_http_client(uri)

def trigger_params(channels, event_name, data, params)
channels = Array(channels).map(&:to_s)
raise Pusher::Error, "Too many channels (#{channels.length}), max 10" if channels.length > 10
raise Pusher::Error, "Too many channels (#{channels.length}), max 100" if channels.length > 100

encoded_data = if channels.any?{ |c| c.match(/^private-encrypted-/) } then
raise Pusher::Error, "Cannot trigger to multiple channels if any are encrypted" if channels.length > 1
Expand Down
2 changes: 1 addition & 1 deletion lib/pusher/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module Pusher
VERSION = '2.0.2'
VERSION = '2.0.3'
end
2 changes: 1 addition & 1 deletion spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@

it "should not allow too many channels" do
expect {
@client.trigger((0..11).map{|i| 'mychannel#{i}'},
@client.trigger((0..101).map{|i| 'mychannel#{i}'},
'event', {'some' => 'data'}, {
:socket_id => "12.34"
})}.to raise_error(Pusher::Error)
Expand Down

0 comments on commit 18109ec

Please sign in to comment.