@@ -28,45 +28,44 @@ var ddpclient = new DDPClient({
2828 /* optional: */
2929 auto_reconnect: true ,
3030 auto_reconnect_timer: 500 ,
31- use_ejson: true , // default is false
32- use_ssl: false , // connect to SSL server,
33- use_ssl_strict: true , // Set to false if you have root ca trouble.
34- maintain_collections: true // Set to false to maintain your own collections.
31+ use_ejson: true , // Use Meteor's EJSON to preserve certain data types.
32+ use_ssl: false ,
33+ maintain_collections: true // Set to false to maintain your own collections.
3534});
3635
3736ddpclient .connect (function (error ) {
3837 if (error) {
3938 console .log (' DDP connection error!' );
4039 return ;
4140 }
42-
41+
4342 console .log (' connected!' );
44-
45- ddpclient .loginWithUsername (" myusername" ," ddp-rocks" ,function (err , result ) {
46- // Do stuff after login
43+
44+ ddpclient .loginWithUsername (" username" , " password" , function (err , result ) {
45+ // result contains your auth token
46+
47+ ddpclient .call (' test-function' , [' foo' , ' bar' ], function (err , result ) {
48+ console .log (' called function, result: ' + result);
49+ });
50+
51+ ddpclient .subscribe (' posts' , [], function () {
52+ console .log (' posts complete:' );
53+ console .log (ddpclient .collections .posts );
54+ });
4755 });
48-
49- ddpclient .call (' test-function' , [' foo' , ' bar' ], function (err , result ) {
50- console .log (' called function, result: ' + result);
51- })
52-
53- ddpclient .subscribe (' posts' , [], function () {
54- console .log (' posts complete:' );
55- console .log (ddpclient .collections .posts );
56- })
5756});
5857
5958/*
6059 * Useful for debugging and learning the ddp protocol
6160 */
62- ddpclient .on (' message' , function (msg ) {
61+ ddpclient .on (' message' , function (msg ) {
6362 console .log (" ddp message: " + msg);
6463});
6564
6665/*
6766 * If you need to do something specific on close or errors.
68- * ( You can also disable auto_reconnect and call ddpclient.connect()
69- * when you are ready to re-connect.)
67+ * You can also disable auto_reconnect and
68+ * call ddpclient.connect() when you are ready to re-connect.
7069*/
7170ddpclient .on (' socket-close' , function (code , message ) {
7271 console .log (" Close: %s %s" , code, message);
@@ -79,14 +78,15 @@ ddpclient.on('socket-error', function(error) {
7978
8079Unimplemented Features
8180====
81+ The node DDP client does not implement ordered collections, something that while in the DDP spec has not been implemented in Meteor yet.
82+
8283* Server to Client messages
8384 * 'addedBefore'
8485 * 'movedBefore'
8586 * 'error'
8687 * 'updated'
8788
8889
89-
9090Thanks
9191======
9292
0 commit comments