General mailing list for discussions and development of PeerLibrary and related software.

List archive Help


Re: [PeerLibrary dev] Questions on Publish/Subscribe in Meteor


Chronological Thread 
  • From: Mitar < >
  • To:
  • Subject: Re: [PeerLibrary dev] Questions on Publish/Subscribe in Meteor
  • Date: Sun, 30 Nov 2014 16:30:17 -0800

Hi!

> I've been looking at annotation.coffee

You mean server/annotation.coffee?

> - Subscriptions work like this: I will subscribe to a new publish
> function I will write (not logged-errors).

Yes. Important is that publish function signature (arguments which it
takes) is the one client-side catalog code expects. See here for example:

https://github.com/peerlibrary/peerlibrary/blob/development/server/annotation.coffee#L251

(limit, filter, sortIndex)
> - I was looking at the meteor documentation on writing publish
> functions, but I haven't seen anywhere that writes publish functions in
> the
> form of "Meteor.publish()", so I'm unsure of the conventions of publish
> functions in PL.

We are using meteor-middleware package:

https://github.com/peerlibrary/meteor-middleware

Which allows some post-processing of documents. In your use case, you do
not have to be concerned with this. Instead of:

Meteor.publish 'logged-errors', (limit, filter, sortIndex) ->

You just do:

new PublishEndpoint 'logged-errors', (limit, filter, sortIndex) ->

Everything else is the same.

See how this is done in annotations.

> - In client/annotations.coffee, the subscription is to 'annotations' so
> where do I find the publish function called 'annotations'?

Here:

https://github.com/peerlibrary/peerlibrary/blob/development/server/annotation.coffee#L251

> - Unless in Meteor it will automatically subscribe to a file with the
> same name in server called annotations.coffee? If this is the case,
> then
> why are we not looking at a file called server/annotations.coffee? and
> instead the example I've been referenced to is
> server/annotation.coffee?

No. There is no automatic logic here. There is some in package
"autopublish" you get when you create a new Meteor project, but we
removed that and are doing publish and subscriptions ourselves.


Mitar

--
PeerLibrary, facilitating the global conversation on academic literature
https://peerlibrary.org/
http://blog.peerlibrary.org/
https://twitter.com/PeerLibrary


  • Re: [PeerLibrary dev] Questions on Publish/Subscribe in Meteor, Mitar, 12/01/2014

Archive powered by MHonArc 2.6.18.

Top of page