Skip to content
This repository has been archived by the owner on May 23, 2018. It is now read-only.

Commit

Permalink
more S, more L, more I, more D
Browse files Browse the repository at this point in the history
  • Loading branch information
Andreas Niedermair committed Feb 17, 2016
1 parent fa698dd commit 39841e7
Show file tree
Hide file tree
Showing 20 changed files with 381 additions and 309 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,14 @@ https://www.nuget.org/packages/UDPBroadcast/
}

var messageSerializer = new MessageSerializer();
var messageBodySerializer = new MessageBodySerializer();
var messageFactory = new MessageFactory();
var pathFactory = new PathFactory();
using (var broker = new Broker(1337,
messageSerializer,
messageFactory))
messageBodySerializer,
messageFactory,
pathFactory))
{
var messageObserver = new MessageObserver<Foo>(broker.ID)
{
Expand All @@ -49,11 +53,15 @@ https://www.nuget.org/packages/UDPBroadcast/
**IMessageFactory**
You can inject your own `IMessageFactory` implementation, to send eg `CustomMessage` instances instead to default `Message`.

Please be aware that you have to implement your own serialization-mechanics when creating your own `IMessage` implementation in the `SetInstance` and `GetInstance` methods.

**IMessageSerializer**
Instead of using the default `BinaryFormatter` as the serializer of `IMessage` instances, you can provide your own serialization mechanism.

**IMessageBodySerializer**
Instead of using the default `BinaryFormatter` as the serializer of `IMessage.Body`, you can provide your own serialization mechanism.

**IPathFactory**
If you ever come across the need to adapt routing from the default `Type.FullName` of the encapsulated instance, you can provider your own implementation.

## License

csharp-UDPBroadcast is published under [WTFNMFPLv3](http://andreas.niedermair.name/introducing-wtfnmfplv3).
Expand Down
15 changes: 12 additions & 3 deletions UDPBroadcast.Example/Program.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
using System;

// ReSharper disable ArrangeTypeModifiers
// ReSharper disable UnusedParameter.Local
// ReSharper disable ClassNeverInstantiated.Global

namespace UDPBroadcast.Example
{
class Program
{
static void Main(string[] args)
{
var messageSerializer = new MessageSerializer();
var messageBodySerializer = new MessageBodySerializer();
var messageFactory = new MessageFactory();
var pathFactory = new PathFactory();
var broker = new Broker(1337,
messageSerializer,
messageFactory);
var messageObserver = new MessageObserver<Foo>(broker.ID)
messageBodySerializer,
messageFactory,
pathFactory);
var messageObserver = new MessageObserver<Foo>(broker.ID,
messageBodySerializer)
{
InterceptRemoteMessagesOnly = false,
InterceptOnNext = foo =>
Expand All @@ -24,7 +33,7 @@ static void Main(string[] args)

broker.Publish(new Foo
{
Bar = "hello"
Bar = "hello" // Not L10N
});

Console.ReadLine();
Expand Down
Loading

0 comments on commit 39841e7

Please sign in to comment.