Tutorial by Examples

Once connected you can publish messages by calling the ISubscriber.Publish method: // grab an instance of an ISubscriber var subscriber = connection.GetSubscriber(); // publish a message to the 'chat' channel subscriber.Publish("chat", "This is a message") Consumers can ...
You can broadcast more complex messages by serializing the payload before you publish it: // definition of a message public class ChatMessage { public Guid Id { get; set; } public string User { get; set; } public string Text { get; set; } } // grab an instance of an ISubscriber...
StackExchange.Redis also supports sending bytes over the pub/sub channel, here we use protobuf-net to serialize our message to a byte array before sending it: // definition of a message (marked up with Protobuf attributes) [ProtoContract] public class ChatMessage { [ProtoMember(1)] pub...

Page 1 of 1