diff --git a/SubData.md b/SubData.md index 98a7bc2..dd94f57 100644 --- a/SubData.md +++ b/SubData.md @@ -4,13 +4,25 @@ SubData, in a similar fashion to the [Plugin Messaging Channel (PMC)](https://ww This is the latest edition of SubData. SubServers.Bungee will open port 4391 (by default) so that all the SubServers apps can communicate with each other. ## Usage -SubData has grown beyond SubServers into [its very own project](https://github.com/ME1312/SubData-2). This means that some things, like the API and Protocol Formatting, have been moved to more appropriate locations on [its new wiki](https://github.com/ME1312/SubData-2/wiki). Here are some topics you may be interested in: +SubData has grown beyond SubServers into [its very own project](https://github.com/ME1312/SubData-2). This means that some things, like the API and Protocol Formatting, have been moved to more appropriate locations on [its new wiki](https://github.com/ME1312/SubData-2/wiki). Here are some additional topics you may be interested in: > [Sending and Receiving Custom Messages](https://github.com/ME1312/SubData-2/wiki/Usage#working-with-packets-and-messages)
> Working with Multiple Data Channels
> Creating Custom Ciphers
> [Network States](https://github.com/ME1312/SubData-2/wiki/Protocol-States)
> [Protocol Formatting](https://github.com/ME1312/SubData-2/wiki/Protocol-Format)
-
+ +## Channel Tracking +SubServers allows multiple SubData channels to be opened from the same source at one time. As a result, the way SubData channels are tracked within SubServers has gotten a little complex. If you're a developer, you may have noticed that when you get the linked client for a server (for example), it now returns an array. + +**The Master Channel**
+The first item in the array `client[0]` is always guaranteed be the master channel; it's id of `0` will never change. The master channel is the initial channel opened by SubServers itself. Additionally, it is always present in the array, even if unavailable. If it does happen to be unavailable it will just simply return a null value, but it shouldn't be that way for long, since SubServers will reconnect this channel automatically. + +**SubChannels**
+Everything else in the array is a subchannel. Each subchannel is dynamically registered with a positive id number. However, this can come with it's own set of problems. + +Let's say we have 2 subchannels connected. If `client[1]` disconnects, this means the next connection to identify itself as a subchannel will get id `1` because that id is no longer in use. However, if you tried to access `client[2]` during the time subchannel `1` was disconnected, you would have been met with an `ArrayIndexOutOfBoundsException` because the position was not the same as the id number. + +Since this method of tracking is clearly unreliable for use cases other than simple listing and iteration, we recommend for the opener of the channel to keep track of it's own subchannel(s).
## Encryption SubServers allows SubData packets to be encrypted with the cipher you choose via the configuration. To disable encryption, go to your SubData settings and set `Encryption` to `None`.