DEV Community

Josua Schmid
Josua Schmid

Posted on

8KB limit of Postgres NOTIFY

You can setup Rails ActionCable to use Postgres instead of Redis by adjusting the adapter configuration:

# config/cable.yml

production:
  adapter: postgresql
  url: <%= ENV["DATABASE_URL"] %>
  channel_prefix: myapp_production
Enter fullscreen mode Exit fullscreen mode

This uses the Postgres LISTEN and NOTIFY commands.

As of writing, the NOTIFY payload is limited to 8000 bytes per default. If you're using Hotwire this may not always be enough and you will see error messages like this

PG::InvalidParameterValue (ERROR:  payload string too long)
Enter fullscreen mode Exit fullscreen mode

The solutions available to you are the following:

Top comments (0)