Skip to content

Events on EventSub WebSocket should set created_at appropriately #264

@Xemdo

Description

@Xemdo

As described in #263, by default the created_at field is automatically set to 1 hour prior to the moment the event is created, and can be overridden with --timestamp.

The behavior should be changed to:

  • In EventSub WebSocket servers without --require-subscription, created_at should default to the time the socket was created. This is because without --require-subscription the server "grants" all event subscriptions at startup.
  • In servers using --require-subscription, created_at should be the time the subscription was created using the mock EventSub subscription REST endpoints.

Example payload:

> twitch event trigger channel.charity_campaign.donate --timestamp=1999-12-31T23:59:59.0000Z
{
  "subscription": {
    "id": "9a1bde48-b26c-facf-d200-6269cf2c19a4",
    "status": "enabled",
    "type": "channel.charity_campaign.donate",
    "version": "1",
    "condition": {
      "broadcaster_user_id": "53988464"
    },
    "transport": {
      "method": "webhook",
      "callback": "null"
    },
    "created_at": "1999-12-31T23:59:59.0000Z",
    "cost": 0
  },
  "event": {
    "campaign_id": "960c7653-cb01-ee00-8fad-2ab12dd532c6",
    "id": "baf9bd8a-e5d9-08be-f7d5-190f949014e2",
    "broadcaster_user_id": "53988464",
    "broadcaster_user_name": "testBroadcaster",
    "broadcaster_user_login": "testBroadcaster",
    "user_id": "76564361",
    "user_name": "testFromUser",
    "user_login": "testFromUser",
    "charity_name": "Example Charity",
    "charity_logo": "https://abc.cloudfront.net/ppgf/1000/100.png",
    "amount": {
      "value": 10000,
      "decimal_places": 2,
      "currency": "USD"
    }
  }
}

Disclaimer

  • I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions