New subs #2

Closed
wants to merge 8 commits into
from

Conversation

Projects
None yet
1 participant
@debergalis
Member

debergalis commented Feb 28, 2012

testing something

@gschmidt @n1mmy

debergalis added some commits Feb 17, 2012

Rework livedata (DDP) subscriptions.
Publish now comes in three flavors:

* Bare metal API: Meteor.publish(name, func).

  Server will call func(sub, params) each time a client subscribes to
  "name" (with supplied "params"), or if "name" is null, each time a new
  client connects (autopublish).  "sub" is a Subscription object, which
  supplies sub.set(), sub.unset(), sub.satisfies(), and sub.flush()
  methods to emit DDP data messages.  func() should register a cleanup
  function with sub.onStop(), which will be called when client unsubs.

  To react to database changes, use Collection.observe().  Publish
  functions that are not database backed may use some other mechanism
  (setInterval?) to schedule calls to sub.set().

* publishCursor API:

  If func() *returns* a Cursor, server will automatically publish all
  results from that cursor as the collection with the same name as the
  cursor's underlying Mongo collection.  For example:

  Meteor.publish('top10', function (sub, params) {
    return Players.find({}, {sort: {score: -1}, limit: 10});
  });

  will define a 'top10' publish that is always the top 10 scoring
  players, published to the 'players' collection on each subscribing
  client.

* autopublish

  When the autopublish package is loaded, all Collections defined on the
  server will automatically be published, in their entirety, to each
  connected client.  Clients need not call Meteor.subscribe().  Calls to
  publish() will emit a warning message, since they are superflous.  To
  disable autopublish, run "meteor remove autopublish".
Sync Minimongo observe API to server.
Return old document in callbacks.  Add LiveResultsSet.collection to
match server.

Add observe() unit test suite.
Support field selection in server-side mongo.
Can now publish subsets of documents with something like this:

Meteor.publish('items', function (sub, params) {
  return Items.find({user_id: params.user_id},
                    {fields: {some_secret_field: 0}});
});

where items.some_secret_fields won't be included in the publish output.

(fields option is ignored by minimongo.)

@debergalis debergalis closed this Apr 12, 2012

glasser added a commit that referenced this pull request Oct 8, 2012

Change interface for determining if the user doc is loading to a new …
…reactive

function Meteor.userLoading(). The value of Meteor.user() is not defined if
userLoading returns true.

The Handlebars helper currentUser is "true" if the user is loading, and a new
helper currentUserLoading is equivalent to Meteor.userLoading.

The current user subscription is now named meteor.currentUser rather than being
an unnamed sub. (loginServiceConfiguration is renamed
meteor.loginServiceConfiguration to match.) This subscription is sub'd from when
you log in and unsub'd from when you log out (or if you log in with different
credentials).

I was very careful to make sure that in the case of "sub #1, unsub #1, sub #2,
sub #1 is ready" we do not declare the user to be ready. I could have instead
modified livedata_connection to not call ready callbacks for unsub'd
subscriptions (add a "delete self.sub_ready_callbacks[obj._id]" to the self.subs
removed function) but this seemed less invasive.

The password and email tests use this to take a more rigorous approach to
waiting for the data to load, and they change the localStorage keys so that
multiple tabs running tests don't interact via localStorage.

glasser added a commit that referenced this pull request Oct 9, 2012

Change interface for determining if the user doc is loaded to a new r…
…eactive

function Meteor.userLoaded(), which is true if you are logged in and the user
doc is loaded, and a currentUserLoaded Handlebars helper to match.

If logged in and the user doc is not yet loaded, Meteor.user() now returns an
object which only contains _id.

The current user subscription is now named meteor.currentUser rather than being
an unnamed sub. (loginServiceConfiguration is renamed
meteor.loginServiceConfiguration to match.) This subscription is sub'd from when
you log in and unsub'd from when you log out (or if you log in with different
credentials).

I was very careful to make sure that in the case of "sub #1, unsub #1, sub #2,
sub #1 is ready" we do not declare the user to be ready. I could have instead
modified livedata_connection to not call ready callbacks for unsub'd
subscriptions (add a "delete self.sub_ready_callbacks[obj._id]" to the self.subs
removed function) but this seemed less invasive.

The password and email tests use this to take a more rigorous approach to
waiting for the data to load, and they change the localStorage keys so that
multiple tabs running tests don't interact via localStorage.

glasser added a commit that referenced this pull request Oct 9, 2012

Change interface for determining if the user doc is loaded to a new r…
…eactive

function Meteor.userLoaded(), which is true if you are logged in and the user
doc is loaded, and a currentUserLoaded Handlebars helper to match.

If logged in and the user doc is not yet loaded, Meteor.user() now returns an
object which only contains _id.

The current user subscription is now named meteor.currentUser rather than being
an unnamed sub. (loginServiceConfiguration is renamed
meteor.loginServiceConfiguration to match.) This subscription is sub'd from when
you log in and unsub'd from when you log out (or if you log in with different
credentials).

I was very careful to make sure that in the case of "sub #1, unsub #1, sub #2,
sub #1 is ready" we do not declare the user to be ready. I could have instead
modified livedata_connection to not call ready callbacks for unsub'd
subscriptions (add a "delete self.sub_ready_callbacks[obj._id]" to the self.subs
removed function) but this seemed less invasive.

The password and email tests use this to take a more rigorous approach to
waiting for the data to load, and they change the localStorage keys so that
multiple tabs running tests don't interact via localStorage.

@vflyson vflyson referenced this pull request Sep 25, 2013

Closed

Meteor.render() bugs #1450

justinsb added a commit that referenced this pull request Sep 9, 2014

Allow passing of arguments to configure-android
Args are passed through to the android tool

Useful commands:

configure-android avd
configure-android list avd
configure-android -- delete avd --name meteor

(Note the extra -- to delineate the args)

(Note #2: the delete avd command doesn't seem to actually work,
though this appears to be an Android bug - it says that is has
deleted it, but it is still there!)

DenisGorbachev added a commit to DenisGorbachev/meteor that referenced this pull request Apr 26, 2015

JonTheNiceGuy added a commit to JonTheNiceGuy/meteor that referenced this pull request Oct 15, 2015

zol added a commit that referenced this pull request May 5, 2016

@pozylon pozylon referenced this pull request Sep 30, 2016

Merged

Release 1.4.2 #7668

benjamn pushed a commit that referenced this pull request Oct 6, 2016

@benjamn benjamn referenced this pull request Jan 15, 2018

Merged

Release 1.6.1 #9274

toinevk added a commit to toinevk/meteor that referenced this pull request Apr 15, 2018

Fix Failing Test #2
Correctly set Env Variable for app config, dynamic imports and modules
tests and add puppeteer as a dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment