public class RelayConfig extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
addManualRelay(PeerAddress manualRelay)
Add a relay to the relays list
|
static RelayConfig |
Android(String registrationId)
Creates an Android relay configuration.
|
static RelayConfig |
Android(String registrationId,
MessageBufferConfiguration bufferConfiguration)
Creates an Android relay configuration having a buffer for received GCM messages.
|
MessageBufferConfiguration |
bufferConfiguration()
Only used for
RelayConfig#ANDROID |
int |
failedRelayWaitTime() |
RelayConfig |
failedRelayWaitTime(int failedRelayWaitTime)
Defines how many seconds to wait at least until asking a relay that
denied a relay request or a relay that failed to act as a relay again
|
Collection<PeerAddress> |
gcmServers()
Only used for
RelayConfig#ANDROID |
RelayConfig |
gcmServers(Set<PeerAddress> gcmServers)
Only used for
RelayConfig#ANDROIDDefines well-known peers that have the ability to send messages over Google Cloud Messaging. |
Collection<PeerAddress> |
manualRelays() |
RelayConfig |
manualRelays(Collection<PeerAddress> manualRelays)
Set the relay list where the peer should connect to
|
int |
maxFail() |
RelayConfig |
maxFail(int maxFail)
Defines how many times a setup with a relay can fail before it's ignored
|
static RelayConfig |
OpenTCP()
Creates a TCP relay configuration
|
int |
peerMapUpdateInterval()
Get the peer map update interval
|
RelayConfig |
peerMapUpdateInterval(int peerMapUpdateInterval)
Defines the time interval of sending the peer map of the unreachable peer
to its relays.
|
String |
registrationId()
Only used for
RelayConfig#ANDROID |
String |
toString() |
RelayType |
type() |
public static RelayConfig OpenTCP()
public static RelayConfig Android(String registrationId)
registrationId - the Google Cloud Messaging registration ID. This can be obtained on an Android
device by providing the correct senderID. The registration ID is unique for each device for
each senderID.public static RelayConfig Android(String registrationId, MessageBufferConfiguration bufferConfiguration)
registrationId - the Google Cloud Messaging registration ID. This can be obtained on an Android
device by providing the correct senderID. The registration ID is unique for each device for
each senderID.bufferConfiguration - to buffer received GCM messages. Having multiple relays, this can help to
reduce battery consumption.public RelayType type()
public int peerMapUpdateInterval()
public RelayConfig peerMapUpdateInterval(int peerMapUpdateInterval)
peerMapUpdateInterval - the interval of updating the own peer map at the relaypublic void addManualRelay(PeerAddress manualRelay)
public RelayConfig manualRelays(Collection<PeerAddress> manualRelays)
manualRelays - publicly reachable relay nodespublic Collection<PeerAddress> manualRelays()
public RelayConfig failedRelayWaitTime(int failedRelayWaitTime)
failedRelayWaitTime - wait time in secondspublic int failedRelayWaitTime()
public RelayConfig maxFail(int maxFail)
maxFail - the allowed number of failspublic int maxFail()
public String registrationId()
RelayConfig#ANDROIDpublic MessageBufferConfiguration bufferConfiguration()
RelayConfig#ANDROIDpublic Collection<PeerAddress> gcmServers()
RelayConfig#ANDROIDPeerBuilderNAT.gcmAuthenticationKey(String).public RelayConfig gcmServers(Set<PeerAddress> gcmServers)
RelayConfig#ANDROIDgcmServers - a set of peers that can send GCM messagesCopyright © 2014. All rights reserved.