-
Notifications
You must be signed in to change notification settings - Fork 2
Home
.Net port of the DDP specification. Why not have a .Net back-end service delivering content to your meteor project to enjoy the safety of a statically typed language.
Still in need of thorough testing and refactoring!!!
Example of usage.
// Create a new instance of the ddp server
var server = new DDPServer(3000);
// Create a reactive collection
var somePublication = server.Publications.Publish("somePublication");
// Convert a document created from a class that inherits from the IDocument interface to a reactive document
IDocument document = new SomeDocument() // Where some document extends IDocument
dynamic reactiveDocument = document.ToReactiveDocument();
// Or convert a document created from a class that doesn't inherit from the IDocument interface by specifying an id parameter
int id = "S0ME1D";
var document2 = new SomeOtherClass();
dynamic reactiveDocument2 = document.ToReactiveDocument(id);
// Add reactive document to publication
somePublication.Add(document1);
// Swap a document in a publication
somePublication.Change(document2); // assumes document2 has the same id
// As the document is reactive subscribers are notified on any changes to a document or the document collection
document2.name = "some new name";
document2.age = 33;
// Enumerate through all subscriptions to a publication
foreach(var subscription in server.Subscriptions.GetSubscriptions("somePublication"))
// Or enumerate through all subscriptions
foreach(var subscription in server.Subscriptions)
// Add methods to be called from DDP method message requests
private dynamic AddProduct(params string[] values)
{
if(values[0] = values[1]){
return true;
}
}
server.Methods.Add("AddProduct", AddProduct);
// Should you choose to invoke a method on the server
server.Methods.Call("AddProduct", param1, param2) // ...