Created
March 25, 2014 03:56
-
-
Save dkam/9755012 to your computer and use it in GitHub Desktop.
Postgresql pub/sub in Ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sequel' | |
DB = Sequel.connect('postgres://user:pass@localhost/db') | |
DB.listen(:my_channel, loop: true) {|channel, pid, payload| puts "Got payload '#{payload}' on channel '#{channel}'" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sequel' | |
DB = Sequel.connect('postgres://user:pass@localhost/db') | |
DB.notify(:my_channel, payload: {a: 1, test: true} ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://rubydoc.org/github/jeremyevans/sequel/master/frames/Sequel/