Hi Jimmy,
Am 19.11.2014 03:23, schrieb Jimmy Jia:
> A couple more questions - I see that a bunch of table-related
> functionality is described or stubbed in PostgreSQLDatabasePublisher.
> There are a few subtleties here that aren't obvious, though, and I was
> hoping for clarification:
Please note that this isn't even announced nor released;) How did you
find it?
>
> 1) The syntax involved uses new functions (json_build_array,
> json_build_object) that are only in PostgreSQL 9.4 - will Crossbar be
> compatible with earlier versions of PostgreSQL?
Not yet decided .. but:
We will add a PG side API providing a PL/pgSQL function to publish().
That function will take a JSON or JSONB argument(s). So it should be
possible to make it work with <9.4, means you will have less convenience
for creating your JSON value to be published, but it should work.
>
> 2) The publisher uses txpostgres, which is not installed by the
> "postgres" extra option for crossbar
Ah, good catch. Fixed:
https://github.com/crossbario/crossbar/commit/5e20e17d4ad0a95f983b14abae89b0a2c24f07cb
Yeah, PG-side API stuff not yet there .. essentially will be what you
wrote below ..
"table" => payload is too long for pushing over NOTIFY/LISTEN, hence
will go over a regular DB table instead.
It will be fully transparent from PG app code.
If payload is small, push over NOTIFY, if not, push over table.
>
> On Tuesday, November 18, 2014 12:30:13 PM UTC-5, Jimmy Jia wrote:
>
> Hi,
>
> I'm looking to build out something with broadly the same goals a
> CRUD API, but with real-time elements. Specifically:
>
> * I have a table in my database
> * I want to allow web clients to be able to maintain a live view
> into that table
> * Each client will be authenticated as a particular user, and
> should only see rows corresponding to that user
> * Clients should be able to upsert and delete from the table
> (essentially I want the API on the client side to look a little
> bit like a dictionary keyed by the table's primary key, so the
> primitive operations look more like upsert/delete rather than
> insert/update/delete)
>
> Naively, it seems like I would want to build this with PubSub for
> dispatching table updates to clients (I'm use PostgreSQL, so with
> TRIGGER -> NOTIFY), along with RPC for requesting initial snapshots
> and updating things on the database side.
>
> I think I have an idea of how to handle authorization on the RPC
> side, but I'm not sure about on the PubSub side. It looks like I
> could either use subscriber whitelisting, or else have a separate
> topic per-user, and use authorization to control who can subscribe
> to which topic. Which is more idiomatic? Neither seems entirely
> ideal to me - whitelisting seems to require my publisher to keep
> track of session IDs, which seems like something I ought to delegate
> to the router, while per-user topics seems to imply that my
> publisher needs to manage a list of subscribed users to know which
> topics to publish to.
>
> Also, are there some sorts of primitives available such that I don't
> have to write myself? For comparison, I'm looking for something a
> little bit like Meteor collections with allow/deny.
>
> Thanks,
> Jimmy Jia
>
> --
> You received this message because you are subscribed to the Google
> Groups "Autobahn" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
autobahnws+...@googlegroups.com
> <mailto:
autobahnws+...@googlegroups.com>.
> To post to this group, send email to
autob...@googlegroups.com
> <mailto:
autob...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/autobahnws/f1acf962-e0b6-4d63-883b-eb12516c78df%40googlegroups.com
> <
https://groups.google.com/d/msgid/autobahnws/f1acf962-e0b6-4d63-883b-eb12516c78df%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit
https://groups.google.com/d/optout.