-
-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add eventsub websocket module (#716)
* feat: add eventsub websocket module * refactor: use more SubscriptionWrapper * fix: obtain latest sub id on unregister * fix: ensure transport is set * fix: avoid NPE on null token * fix: serialize transport method as lowercase * chore(eventsub): skip nulls when serializing subscription * fix: avoid NPE in TwitchEventSocketPool#handleUnsubscription * fix: use associated token on unregister * fix: use default token even if null is passed to register * chore: add websocket_disconnected status * feat: allow multi-user eventsub ws pool * fix: stricter pool close behavior * refactor: simplify eventsub ws pools * chore: rename package * refactor: simplify some logic * docs: explain methods of IEventSubSocket * docs: explain various eventsocket impl classes * feat: add meta events for eventsub websockets * refactor: throw exception on pool usage after close * refactor: use EventManagerUtils.initializeEventManager * fix: improve long-term reconnect robustness * feat: allow custom backoff strategy * feat: add sub delete failure meta event * fix: add EventSocketDeleteSubscriptionFailureEvent * feat: add eventsocket to client builders * feat: skip retry create sub if 4xx error * feat: add advancedConfiguration to TwitchEventSocketPool * chore: log when not retrying * fix: avoid reconnecting when unused * fix(builders): apply eventsub proxy via advanced config * feat: add EventSocketSubscriptionFailureEvent#willRetry * chore: more annotations
- Loading branch information
Showing
38 changed files
with
1,931 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 44 additions & 1 deletion
45
eventsub-common/src/main/java/com/github/twitch4j/eventsub/EventSubTransport.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,77 @@ | ||
package com.github.twitch4j.eventsub; | ||
|
||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
import lombok.Setter; | ||
import lombok.With; | ||
import lombok.extern.jackson.Jacksonized; | ||
import org.jetbrains.annotations.ApiStatus; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.time.Instant; | ||
|
||
@Data | ||
@Builder | ||
@Setter(AccessLevel.PRIVATE) | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Jacksonized | ||
@JsonInclude(JsonInclude.Include.NON_NULL) | ||
public class EventSubTransport { | ||
|
||
/** | ||
* The transport method. | ||
*/ | ||
@NotNull | ||
private EventSubTransportMethod method; | ||
|
||
/** | ||
* The callback URL where the notification should be sent. | ||
* <p> | ||
* Specify this field only if method is set to webhook. | ||
*/ | ||
@Nullable | ||
private String callback; | ||
|
||
/** | ||
* The secret used for verifying a signature. | ||
* The secret used for verifying a webhook signature. | ||
* <p> | ||
* The secret must be an ASCII string that’s a minimum of 10 characters long and a maximum of 100 characters long. | ||
* <p> | ||
* Specify this field only if method is set to webhook. | ||
*/ | ||
@Nullable | ||
private String secret; | ||
|
||
/** | ||
* An ID that identifies the WebSocket that notifications are sent to. | ||
* <p> | ||
* Specify this field only if method is set to websocket. | ||
*/ | ||
@With | ||
@Nullable | ||
@Setter(value = AccessLevel.PUBLIC, onMethod_ = { @Deprecated, @ApiStatus.Internal }) | ||
private String sessionId; | ||
|
||
/** | ||
* The UTC date and time that the WebSocket connection was established. | ||
* <p> | ||
* Included only if method is set to websocket. | ||
*/ | ||
@Nullable | ||
private Instant connectedAt; | ||
|
||
/** | ||
* The UTC date and time that the WebSocket connection was lost. | ||
* <p> | ||
* Included only if method is set to websocket. | ||
*/ | ||
@Nullable | ||
private Instant disconnectedAt; | ||
|
||
} |
Oops, something went wrong.