Git Product home page Git Product logo

zeta's Introduction

Zeta

No-nonsense, high performance pub-sub for distributing time-critical data over UDP.

How to I make it go?

Create a server and publish a stream of realtime data:

var server = new ZetaUdpPublisher(); 
server.Start(1000); // Listed on UDP port 1000
server.Publish(new StringMessage("Message 1")); // Publish a stream of messages
server.Publish(new StringMessage("Message 2"));
server.Publish(new StringMessage("Message 3"));
// etc...

Create clients and subscribe to the data stream:

var client = new ZetaUdpSubscriber();
client.Start("127.0.0.1:1000"); // Connect to localhost port 1000
while (true) {
    var msg = client.Read<StringMessage>(); // Receive message
    Console.WriteLine($"> {msg}");
}

If values are published faster than clients can recieve them, the older "stale" updates will be dropped in favour of the more recent updates.

If you have multiple seperate streams of data, you can seperate them by assigning a numeric "topic" to each stream:

server.Publish(new StringMessage("Topic 1, message 1"), 1);
server.Publish(new StringMessage("Topic 2, message 1"), 2);

This means that if receivers incur any form of delay receiving updates, they will always receive the latest update for each topic.

What happens if a client connects after a value is published?

The server will automatically retransmit the latest value for each topic.

You can stop this from occuring by publishing a NULL on a topic:

server.Publish(null, 1);

Whats the deal with StringMessage? Are there other message types?

Of course! StringMessage is the simplest type of message for transporting strings. You can use BinaryMessage for byte arrays or create your own for even better control. See InvertedTomato.Messages for all types. Feel free to request (or pull-request) new ones - they're super easy to make.

Will updates arrive in order? (UDP doesn't garantee order)

You'll never receive an older update after a newer one. It is possible that an update may be lost though in favour of a newer one, as discussed above.

Does Zeta retransmit updates if they're lost (UDP doesn't garantee reliability)

Yes, Zeta will retransmit updates as needed.

What is the maximum size of a message?

It depends on your network. Most networks support UDP packets of 1,500 bytes or greater. However old-school networks might only support 520 bytes. By default Zeta is configured to use this worst-case value of 520 bytes. Change this in Mtu if needed.

If a message exceeds the maximum of the network (and you've incorrectly increased the maximum in Mtu) the messages will never arrive at clients.

Is it thread safe?

Zeta is thread safe. You can call Publish from as many threads as you want, simaltaniously.

zeta's People

Stargazers

Halid Cisse avatar  avatar Ben Gamble avatar dzmitry-lahoda avatar Enrico Speranza avatar Stanislav Denisov avatar  avatar Alex Meyer-Gleaves avatar

Watchers

Ben Thompson avatar James Cloos avatar D Bullock avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.