Skip to content

Commit

Permalink
feature: allow setting a custom chatServer in the twitchClientBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippHeuer committed Jul 15, 2020
1 parent c561dde commit 01d6b38
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
6 changes: 6 additions & 0 deletions chat/src/main/java/com/github/twitch4j/chat/TwitchChat.java
Expand Up @@ -70,6 +70,11 @@ public class TwitchChat implements AutoCloseable {
*/
public static final String TWITCH_WEB_SOCKET_SERVER = "wss://irc-ws.chat.twitch.tv:443";

/**
* ThirdParty WebSocket Server for Testing
*/
public static final String FDGT_TEST_SOCKET_SERVER = "wss://irc.fdgt.dev";

/**
* The websocket url for the chat client to connect to.
*/
Expand All @@ -90,6 +95,7 @@ public class TwitchChat implements AutoCloseable {
* The connection state
* Default: ({@link TMIConnectionState#DISCONNECTED})
*/
@Getter
private volatile TMIConnectionState connectionState = TMIConnectionState.DISCONNECTED;

/**
Expand Down
4 changes: 2 additions & 2 deletions docs/content/getting-started/installation.md
Expand Up @@ -18,7 +18,7 @@ and: (latest, you should use the actual version here)

```groovy
dependencies {
compile group: 'com.github.twitch4j', name: 'twitch4j', version: '1.0.0'
compile group: 'com.github.twitch4j', name: 'twitch4j', version: '1.1.0'
}
```

Expand All @@ -38,6 +38,6 @@ and: (latest, you should use the actual version here)
<dependency>
<groupId>com.github.twitch4j</groupId>
<artifactId>twitch4j</artifactId>
<version>1.0.0</version>
<version>1.1.0</version>
</dependency>
```
Expand Up @@ -146,6 +146,14 @@ public class TwitchClientBuilder {
@With
private long chatQueueTimeout = 1000L;

/**
* Sets the default server used for chat
* <p>
* Defaults to TwitchChat.TWITCH_WEB_SOCKET_SERVER, you can use TwitchChat.FDGT_TEST_SOCKET_SERVER for testing
*/
@With
private String chatServer = TwitchChat.TWITCH_WEB_SOCKET_SERVER;

/**
* CredentialManager
*/
Expand Down Expand Up @@ -278,6 +286,7 @@ public TwitchClient build() {
.withChatQueueSize(chatQueueSize)
.withChatRateLimit(chatRateLimit)
.withScheduledThreadPoolExecutor(scheduledThreadPoolExecutor)
.withBaseUrl(chatServer)
.withChatQueueTimeout(chatQueueTimeout)
.withCommandTriggers(commandPrefixes)
.withProxyConfig(proxyConfig)
Expand Down

0 comments on commit 01d6b38

Please sign in to comment.