This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace XNotify | |
{ | |
public class Appointment | |
{ | |
/// <summary> | |
/// Id of the appointment | |
/// </summary> | |
public Guid Id { get; set; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code below will output... | |
/* | |
Name: Boston Zoo | |
Animals in Zoo | |
Type: Lion | |
Says: My name is gorgeous george | |
Is Carnivore: True | |
Type: Horse | |
Says: Where's my cowboy? | |
Is Carnivore: False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Code below will output... | |
/* | |
Name: Boston Zoo | |
Animals in Zoo | |
Type: Lion | |
Says: My name is gorgeous george | |
Is Carnivore: True | |
Type: Horse | |
Says: Where's my cowboy? | |
Is Carnivore: False |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The RealTime controller of XSockets.NET | |
public class Chat : XSocketController | |
{ | |
public string Nickname { get; set; } | |
public void ChatMessage(string text) | |
{ | |
this.SendToAll(new { text, date = DateTime.Now, nickName = this.Nickname },"onChatMessage"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//The interfaces export the correct inteface, but can also import interfaces on properties. | |
//The implementing class does not need to do any imports/exports. It will be taken care of.... | |
[Export(typeof(IZoo))] | |
public interface IZoo | |
{ | |
[ImportMany(typeof(IAnimal))] | |
IList<IAnimal> Animals { get; set; } | |
} | |
[Export(typeof(IAnimal))] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Zoo : IZoo | |
{ | |
public IList<IAnimal> Animals { get; set; } | |
} | |
public class Frog : IAnimal | |
{ | |
public string Say() | |
{ | |
return "Riiiibbitt"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Note that we as always in XSockets only have to implement the interface and the framework will find the plugin. | |
If you wan tto you can even load assemblies with plugins at runtime (or just reference them if youre lazy) | |
*/ | |
/// <summary> | |
/// An example of a custom message interceptor that writes to performancecounters for messages. | |
/// | |
/// Note: Be sure do use thread safe techniques in interceptors | |
/// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var wss = Composable.GetExport<IXSocketServerContainer>(); | |
//These are my siblings on the same server but other ports | |
//This is all that's needed to enable cluster-functionality | |
wss.Siblings.Add("ws://127.0.0.1:4506"); | |
wss.Siblings.Add("ws://127.0.0.1:4507"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// A module that lets you override the default behavior of incomming/outgoing messages | |
/// </summary> | |
public class MyPipeline : XSocketPipeline | |
{ | |
//Incomming textmessage | |
public override void OnMessage(IXSocketController controller, ITextArgs e) | |
{ | |
base.OnMessage(controller, e); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// A module that lets you override the default behavior of incomming/outgoing messages | |
/// </summary> | |
public class MyPipeline : XSocketPipeline | |
{ | |
/// <summary> | |
/// A performance counter for messages | |
/// </summary> | |
private static readonly XSocketsMessageCounter MessageCounter; | |
OlderNewer