Skip to content

Example Application #2

@bangonkali

Description

@bangonkali

I have started the following application,

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Net.DDP.Client;

namespace Net.DDP.Client.Cli
{
    class Program
    {
        static void Main(string[] args)
        {
            IDataSubscriber subscriber = new Subscriber();
            DDPClient client = new DDPClient(subscriber);

            client.Connect("localhost:3000");
            client.Subscribe("allMovies");
        }
    }
    public class Subscriber : IDataSubscriber
    {
        public void DataReceived(dynamic data)
        {
            try
            {
                if (data.type == "sub")
                {
                    Console.WriteLine(data.title + ": " + data.director);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
}

Everytime I start the debug, it seems that the command prompt doesn't have any output even though my publish in meteor has some data.

On the Server.js i have this file:

// Declare server Movies collection
Movies = new Meteor.Collection("movies");

// Seed the movie database with a few movies
Meteor.startup(function () {
    if (Movies.find().count() == 0) {
        Movies.insert({ title: "Star Wars", director: "Lucas" });
        Movies.insert({ title: "Memento", director: "Nolan" });
        Movies.insert({ title: "King Kong", director: "Jackson" });
    }
});

Meteor.publish("allMovies", function () {
  return Movies.find(); // everything
});

Any recommendations?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions