Skip to content

Instantly share code, notes, and snippets.

@somdoron
Last active November 6, 2015 09:25
Show Gist options
  • Save somdoron/666a6fcf59adb9835e37 to your computer and use it in GitHub Desktop.
Save somdoron/666a6fcf59adb9835e37 to your computer and use it in GitHub Desktop.
public class Client
{
/// <summary>
/// List of address to connect to. Will connect to the first one responding. Connected address can changed if disconnected.
/// </summary>
public void Connect(IEnumerable<string> addresses)
{
}
public Task<byte[]> SendRequestAsync(string service, string subject, byte[] message)
{
return null;
}
public Task SendOneWayAsync(string service, string subject, byte[] message)
{
return null;
}
}
public interface IServerHandler
{
Task<Message> HandleRequestAsync(string service, string subject, byte[] body);
void HandleOneWay(string service, string subject, byte[] body);
}
public interface ISubscriberHandler
{
void Handle(string stream, byte[] body);
}
public struct Message
{
public Message(string subject, byte[] body)
{
Subject = subject;
Body = body;
}
public string Subject { get; private set; }
public byte[] Body { get; private set; }
}
public class Publisher
{
public void Bind(string address, params object[] args)
{
}
public void Publish(string stream, byte[] body)
{
}
}
public class Server
{
public Server(IServerHandler handler)
{
}
/// <summary>
/// Bind the server to an address. Can be called multiple times. Address for clients only
/// </summary>
/// <param name="address"></param>
/// <param name="args"></param>
public void Bind(string address, params object[] args)
{
}
}
public class Subscriber
{
public Subscriber(ISubscriberHandler handler)
{
}
/// <summary>
/// List of address to connect to. Will connect to the first one responding. Connected address can changed if disconnected.
/// </summary>
public void Connect(IEnumerable<string> addresses)
{
}
public void Subscribe(string stream)
{
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment