Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.net c# error "'meteorddp.Program.Subscriber' does not implement interface member 'Net.DDP.Client.IDataSubscriber.Session'" #12

Open
daniel6435 opened this issue Sep 5, 2016 · 2 comments

Comments

@daniel6435
Copy link

hi there,

i new in .net c#, i try to call method from meteor sever though ddp.
i using nuget version DDPClient (https://www.nuget.org/packages/Meteor.DDP/), and my visual studio version is 2012.
below is my code that copy from the homepage, but the error show 'meteorddp.Program.Subscriber' does not implement interface member 'Net.DDP.Client.IDataSubscriber.Session'

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

namespace meteorddp
{
class Program
{
static void Main(string[] args)
{
IDataSubscriber subscriber = new Subscriber();
DDPClient client = new DDPClient(subscriber);

        client.Connect("localhost:3000");
        client.Subscribe("allproducts");
    }

    public class Subscriber : IDataSubscriber
    {
        public void DataReceived(dynamic data)
        {
            try
            {
                if (data.type == "sub")
                {
                    Console.WriteLine(data.prodCode + ": " + data.prodName + ": collection: " + data.collection);
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
    }       

}

}`

so what is the problem cause the error?
thanks

@pedropedro0325
Copy link

hi dude,
did you found the solution?

@MarceloPrado
Copy link

You just need to declare the other interface method inside Subscriber class:

public class Subscriber : IDataSubscriber
		{
			public void DataReceived(dynamic data)
			{
				try
				{
					if (data.type == "sub")
					{
						Console.WriteLine(data.prodCode + ": " + data.prodName + ": collection: " + data.collection);
					}
				}
				catch (Exception ex)
				{
					throw;
				}
			}

			public string Session
			{
				get;
				set;
			}
		}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants