-
Notifications
You must be signed in to change notification settings - Fork 16
/
PubSubMessage.cs
56 lines (51 loc) · 1.4 KB
/
PubSubMessage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using Ipfs;
using ProtoBuf;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PeerTalk.PubSub
{
/// <summary>
/// The PubSub message exchanged between peers.
/// </summary>
/// <seealso ref="https://github.com/libp2p/specs/blob/master/pubsub/README.md"/>
[ProtoContract]
public class PubSubMessage
{
/// <summary>
/// Sequence of topic subscriptions of the sender.
/// </summary>
[ProtoMember(1)]
public Subscription[] Subscriptions;
/// <summary>
/// Sequence of topic messages.
/// </summary>
[ProtoMember(2)]
public PublishedMessage[] PublishedMessages;
}
/// <summary>
/// A peer's subscription to a topic.
/// </summary>
/// <seealso ref="https://github.com/libp2p/specs/blob/master/pubsub/README.md"/>
[ProtoContract]
public class Subscription
{
/// <summary>
/// Determines if the topic is subscribed to.
/// </summary>
/// <value>
/// <b>true</b> if subscribing; otherwise, <b>false</b> if
/// unsubscribing.
/// </value>
[ProtoMember(1)]
public bool Subscribe;
/// <summary>
/// The topic name/id.
/// </summary>
[ProtoMember(2)]
public string Topic;
}
}