|
4 | 4 | import lombok.Getter; |
5 | 5 | import lombok.Setter; |
6 | 6 |
|
| 7 | +import java.util.UUID; |
| 8 | + |
7 | 9 | @Getter |
8 | 10 | @Setter |
9 | 11 | public class PnConfiguration { |
10 | 12 |
|
| 13 | + /** |
| 14 | + * By default, the origin is pointing directly to PubNub servers. If a proxy origin is neeeded, set a custom |
| 15 | + * origin using this parameter. |
| 16 | + */ |
11 | 17 | private String origin; |
12 | 18 | private int subscribeTimeout; |
| 19 | + /** |
| 20 | + * In seconds, how long the server will consider this client to be onlien before issuing a leave event |
| 21 | + */ |
13 | 22 | private int presenceTimeout; |
| 23 | + /** |
| 24 | + * In seconds, How often the client should announce it's existance via heartbeating. |
| 25 | + */ |
14 | 26 | private int heartbeatInterval; |
| 27 | + /** |
| 28 | + * set to true to switch the client to HTTPS:// based communications |
| 29 | + */ |
15 | 30 | private boolean secure; |
| 31 | + /** |
| 32 | + * Subscribe Key provided by PubNub |
| 33 | + */ |
16 | 34 | private String subscribeKey; |
| 35 | + /** |
| 36 | + * Publish Key provided by PubNub |
| 37 | + */ |
17 | 38 | private String publishKey; |
18 | 39 | private String secretKey; |
19 | 40 | private String cipherKey; |
20 | 41 | private String authKey; |
21 | | - private String UUID; |
| 42 | + private String uuid; |
| 43 | + /** |
| 44 | + * If proxies are forcefully caching requests, set to true to allow the client to randomize the subdomain. |
| 45 | + * This configuration is not supported if custom origin is enabled. |
| 46 | + */ |
22 | 47 | private boolean cacheBusting; |
23 | 48 |
|
| 49 | + /** |
| 50 | + * Stores the maximum number of seconds which the client should wait for connection before timing out. |
| 51 | + */ |
| 52 | + private int connectTimeout; |
| 53 | + |
| 54 | + /** |
| 55 | + * Stores reference on maximum number of seconds which client should wait for events from live feed |
| 56 | + */ |
| 57 | + private int subscribeMaximumIdleTime; |
| 58 | + |
| 59 | + /** |
| 60 | + * Reference on number of seconds which is used by client during non-subscription operations to |
| 61 | + check whether response potentially failed with 'timeout' or not. |
| 62 | + */ |
| 63 | + private int nonSubscribeRequestTimeout; |
| 64 | + |
| 65 | + public PnConfiguration() { |
| 66 | + // TODO: work w/ dynamic configurations for intervals |
| 67 | + presenceTimeout = 300; |
| 68 | + heartbeatInterval = 148; |
| 69 | + uuid = UUID.randomUUID().toString(); |
| 70 | + |
| 71 | + nonSubscribeRequestTimeout = 10; |
| 72 | + subscribeMaximumIdleTime = 310; |
| 73 | + connectTimeout = 5; |
| 74 | + |
| 75 | + } |
| 76 | + |
| 77 | + |
24 | 78 | } |
0 commit comments