@@ -28,10 +28,9 @@ 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 ) {
@@ -42,31 +41,31 @@ ddpclient.connect(function(error) {
4241
4342 console .log (' connected!' );
4443
45- ddpclient .loginWithUsername (" myusername" ," ddp-rocks" ,function (err , result ) {
46- // Do stuff after login
47- });
44+ ddpclient .loginWithUsername (" username" , " password" , function (err , result ) {
45+ // result contains your auth token
4846
49- ddpclient .call (' test-function' , [' foo' , ' bar' ], function (err , result ) {
50- console .log (' called function, result: ' + result);
51- })
47+ ddpclient .call (' test-function' , [' foo' , ' bar' ], function (err , result ) {
48+ console .log (' called function, result: ' + result);
49+ });
5250
53- ddpclient .subscribe (' posts' , [], function () {
54- console .log (' posts complete:' );
55- console .log (ddpclient .collections .posts );
56- })
51+ ddpclient .subscribe (' posts' , [], function () {
52+ console .log (' posts complete:' );
53+ console .log (ddpclient .collections .posts );
54+ });
55+ });
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);
@@ -86,14 +85,15 @@ var oid = new ddpclient.EJSON.ObjectID();
8685
8786Unimplemented Features
8887====
88+ The node DDP client does not implement ordered collections, something that while in the DDP spec has not been implemented in Meteor yet.
89+
8990* Server to Client messages
9091 * 'addedBefore'
9192 * 'movedBefore'
9293 * 'error'
9394 * 'updated'
9495
9596
96-
9797Thanks
9898======
9999
0 commit comments