-
-
Save alekpopovic/e63e03055c2da9d18f5e685291e64112 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