Commit Graph

442 Commits

Author SHA1 Message Date
Geoff Schmidt
79aabd797b make apply() somewhat more idiomatic 2012-03-01 05:11:56 -08:00
Geoff Schmidt
562a1a1122 Merge branch 'livedata-reconnection' 2012-03-01 03:59:54 -08:00
Geoff Schmidt
e48f335e94 Make requests idempotent on a connection
Use a replay cache. When a request is replayed, replay the response. Prune the replay cache based on a timer, but only when the session is connected.
2012-03-01 03:56:10 -08:00
Geoff Schmidt
8fc57d02fb helper for manually testing session reconnection 2012-03-01 03:28:18 -08:00
Geoff Schmidt
3f51c557a5 Implement reconnection on the client. 2012-03-01 03:04:35 -08:00
Geoff Schmidt
1353d48c72 Implement reconnection on the server. 2012-03-01 02:37:01 -08:00
Geoff Schmidt
363fb71443 allow session to exist without a socket 2012-03-01 02:37:01 -08:00
Geoff Schmidt
671b1833a8 route all message sending through session 2012-03-01 02:37:01 -08:00
Geoff Schmidt
a87c077f22 serialize all messages from each client 2012-03-01 02:37:01 -08:00
Geoff Schmidt
605838fbfa minor refactor 2012-03-01 02:37:01 -08:00
Geoff Schmidt
c8b5052add move message dispatch fully into LivedataSession 2012-03-01 02:37:01 -08:00
Geoff Schmidt
5bfc4c472b Don't create session until connect is received 2012-03-01 02:37:01 -08:00
Geoff Schmidt
071e055e7c refactor more methods onto LivedataSession 2012-03-01 02:37:01 -08:00
Geoff Schmidt
d8b01cb7fb cosmetic: match style on LivedataSubscription 2012-03-01 02:37:00 -08:00
Geoff Schmidt
ff9eaea2b8 refactor methods on to LivedataSession 2012-03-01 02:37:00 -08:00
Geoff Schmidt
e85226f21f refactor: stream errors; sessions off of sockets 2012-03-01 02:37:00 -08:00
Geoff Schmidt
68345e7c06 factor out ClientInvocation
on reconnect, send methods in order
2012-02-29 23:38:12 -08:00
matt debergalis
26d75bef7e Merge branch 'new-subs' 2012-02-29 16:11:31 -08:00
matt debergalis
55c9a27d94 bump timeout to 5 sec 2012-02-29 16:09:00 -08:00
matt debergalis
d5fd6e8738 Update documentation. 2012-02-29 16:08:59 -08:00
matt debergalis
3f1ff26e43 Convert to new publish API. 2012-02-29 16:08:59 -08:00
matt debergalis
8a8e402510 autopublish in leaderboard 2012-02-29 16:08:59 -08:00
matt debergalis
c0b3df5a91 Sync Minimongo observe API to server.
Return old document in callbacks.  Add LiveResultsSet.collection to
match server.

Add observe() unit test suite.
2012-02-29 16:08:58 -08:00
matt debergalis
b35af422c6 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.)
2012-02-29 16:08:58 -08:00
matt debergalis
cb887f5a9b 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".
2012-02-29 16:08:58 -08:00
David Greenspan
5aeff801c3 deepcopy consistently in minimongo callbacks (to not mask bugs) 2012-02-29 13:16:16 -08:00
Geoff Schmidt
980868bc1b Merge branch 'methods' 2012-02-29 04:38:40 -08:00
Geoff Schmidt
5cf9351ecd Test compound methods, including clients cheating 2012-02-29 04:36:51 -08:00
Geoff Schmidt
72e37d8748 Method invocation tests pass on server
(as well as client)
2012-02-29 02:04:33 -08:00
Geoff Schmidt
4f04e0fb6a don't offer to debug server tests on the client 2012-02-29 01:47:42 -08:00
Geoff Schmidt
16b2de8e8c show overall test status
(makes it easier to see if server tests haven't returned)
2012-02-29 01:08:22 -08:00
Geoff Schmidt
f41d692cf5 method invocation context object
(including support for async methods, server-side
method ordering, running simulated methods
correctly)
2012-02-29 00:42:38 -08:00
matt debergalis
c228996976 fix merge error 2012-02-23 15:05:17 -08:00
Geoff Schmidt
9d3b86fa44 Additional bindEnvironment testing 2012-02-23 14:46:42 -08:00
matt debergalis
09f210c9e4 simplify result_func handling for remote method callbacks. 2012-02-23 13:14:06 -08:00
Geoff Schmidt
97c3e50379 Support server-side tests. 2012-02-23 06:08:09 -08:00
Geoff Schmidt
3d8b3b6e1d Implement dynamic scoping, bindEnvironment
tests on client, not yet on server
2012-02-23 03:44:41 -08:00
Geoff Schmidt
58a2d65126 Provide package 'meteor' to create the Meteor global
Fold old package 'core' into it
2012-02-23 02:21:10 -08:00
Geoff Schmidt
72fda4871a Merge branch 'refs/heads/livedata-tests' 2012-02-23 02:05:06 -08:00
Geoff Schmidt
e8e2d956a2 Work around Uglify bug
(incorrect minification of 'debugger')
2012-02-23 01:00:25 -08:00
Geoff Schmidt
1c8e498e1e Use a fresh collection each time the test is run
(so it can be rerun)
2012-02-23 01:00:02 -08:00
David Greenspan
08c3d13465 prevent collection remove from triggering add 2012-02-21 15:25:34 -08:00
Geoff Schmidt
e0722bedf8 basic livedata method invocation tests 2012-02-21 01:40:15 -08:00
Geoff Schmidt
8cf92b18ef reinstate ability to open debugger on a test
(also, restore ability to catch exceptions in tests)
2012-02-20 23:58:59 -08:00
Geoff Schmidt
6acaeb0ee6 refactor tinytest for async 2012-02-20 22:12:31 -08:00
Geoff Schmidt
1d3154bd54 livedata fixes 2012-02-19 14:44:32 -08:00
David Greenspan
5385c4a358 missing underscore 2012-02-17 20:48:17 -08:00
Nick Martin
54ddf0c280 Merge branch 'livedata-connect' 2012-02-17 12:08:28 -08:00
Geoff Schmidt
bd1e4eb858 leaderboard-remote example 2012-02-17 01:58:15 -08:00
Geoff Schmidt
7a8e7f5ea3 data refactoring cleanups in some tests 2012-02-17 01:33:18 -08:00