Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add functionality for Postgres Listen and Notify #40

Closed
JonEustace opened this issue Mar 29, 2018 · 3 comments
Closed

Add functionality for Postgres Listen and Notify #40

JonEustace opened this issue Mar 29, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@JonEustace
Copy link

Postgres offers a pub / sub listen and notify, it would be amazing if Vapor 3 could implement this. Perfect for realtime updates.

@tanner0101 tanner0101 added the enhancement New feature or request label Mar 29, 2018
@pedantix
Copy link
Member

I can dig in on this. assuming just like redis then we should be able to mimick command names in appliance

Subscribe

Info (https://www.postgresql.org/docs/10/static/sql-listen.html)

conn.listen(_  channel: String,   @escaping (PostgreSQLData) -> Void) -> Futue<Conn>

Publish

Info (https://www.postgresql.org/docs/10/static/sql-notify.html)

conn.notify(_ channel: String, payload: PostgrSQLData) -> Futue<Void>

@pedantix
Copy link
Member

In Progress no one complained so I am implementing

@pedantix pedantix mentioned this issue Mar 31, 2018
@tanner0101 tanner0101 added this to the 1.0.0 milestone Jun 2, 2018
@tanner0101
Copy link
Member

Publicized in #72:

let conn = try PostgreSQLConnection.makeTest(transport: .cleartext)
let done = conn.listen("foo") { message in
    XCTAssertEqual(message, "hi")
    return true
}
do {
    let conn = try PostgreSQLConnection.makeTest(transport: .cleartext)
    _ = try conn.notify("foo", message: "hi").wait()
}
try done.wait()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants