Skip to content
Postgresql PubSub adapter for Phoenix apps
Elixir
Latest commit bddb977 May 2, 2015 @shankardevy shankardevy Merge pull request #2 from josevalim/patch-1
Properly shut down postgres connection
Failed to load latest commit information.
config initial commit Mar 21, 2015
lib Merge pull request #2 from josevalim/patch-1 May 2, 2015
test initial commit Mar 21, 2015
.gitignore initial commit Mar 21, 2015
README.md update readme Mar 27, 2015
mix.exs fix syntax error in package info Mar 27, 2015

README.md

PhoenixPubSubPostgres

This package provides postgres adapater for Phoenix's Pub/Sub channels.

Demo

Open pgchat.opendrops.com in two different browsers windows and start sending some messages. The message passing is handled by postgres's built-in pubsub support

Demo app source

Source code of the demo app is available at http://github.com/opendrops/pgchat-demo-app

-

How to use

Add phoenix_pubsub_postgres to your mix deps

defp deps do
  [{:phoenix, github: "phoenixframework/phoenix", override: true},
   {:phoenix_pubsub_postgres, "~> 0.0.2"},
   {:postgrex, ">= 0.0.0"},
   {:cowboy, "~> 1.0"}]
end

To use Postgres as your PubSub adapter, simply add it to your Endpoint's config and modify it as needed.

config :my_app, MyApp.Endpiont,
  ...
  pubsub: [name: MyApp.PubSub,
           adapter: PhoenixPubSubPostgres,
           hostname: "localhost",
           database: "myapp_db_env",
           username: "postgres",
           password: "postgres"]
Something went wrong with that request. Please try again.