twitch-rs / twitch_api

Rust library for talking with the Twitch API aka. "Helix", TMI and more! Use Twitch endpoints fearlessly!
Apache License 2.0
150 stars 33 forks source link

Enum twitch_api::eventsub::Status unknown variant `websocket_failed_to_reconnect` #400

Closed Samoth69 closed 7 months ago

Samoth69 commented 8 months ago

Hello

disclaimer: I'm not really used to do issues nor an expert in Rust or Twitch API, if I made a silly mistake I'm sorry in advance

Introduction

I'm using the example code available here, it cause a failed mapping (see error below).

It seems Twitch API is returning for my subscriptions an undocumented status websocket_failed_to_reconnect

Error

HelixRequestGetError(
DeserializeError("JSON API answer, redacted for readability see sample below"
PathError { 
path: "data[0].status", 
error: Error("unknown variant `websocket_failed_to_reconnect`, expected one of `enabled`, `webhook_callback_verification_pending`, `webhook_callback_verification_failed`, `notification_failures_exceeded`, `authorization_revoked`, `moderator_removed`, `user_removed`, `version_removed`, `websocket_disconnected`, `websocket_failed_ping_pong`, `websocket_received_inbound_traffic`, `websocket_connection_unused`, `websocket_internal_error`, `websocket_network_timeout`, `websocket_network_error`",
 line: 1, column: 105) 
}, https://api.twitch.tv/helix/eventsub/subscriptions?, 200))

API Result for https://api.twitch.tv/helix/eventsub/subscriptions

{
  "total": 11,
  "data": [
    {
      "id": "4fa0bdca-98a7-4307-9038-d86ea4f95ef5",
      "status": "websocket_failed_to_reconnect",
      "type": "stream.online",
      "version": "1",
      "condition": {
        "broadcaster_user_id": "Redacted"
      },
      "created_at": "2024-03-21T17:03:55.498320074Z",
      "transport": {
        "method": "websocket",
        "session_id": "Redacted",
        "connected_at": "2024-03-21T17:03:55Z",
        "disconnected_at": "2024-03-21T17:14:54Z"
      },
      "cost": 0
    },
    {
      "id": "cea0fae2-06fc-4d3a-bc65-e22cdd800d62",
      "status": "websocket_failed_to_reconnect",
      "type": "stream.offline",
      "version": "1",
      "condition": {
        "broadcaster_user_id": "Redacted"
      },
      "created_at": "2024-03-21T17:03:55.895093996Z",
      "transport": {
        "method": "websocket",
        "session_id": "Redacted",
        "connected_at": "2024-03-21T17:03:55Z",
        "disconnected_at": "2024-03-21T17:14:54Z"
      },
      "cost": 0
    }
    items redacted for readability
  ],
  "max_total_cost": 10,
  "total_cost": 0,
  "pagination": {}
}

I'm not sure of what to do now, Should I report to twitch that they have something missing in their docs ?

Nerixyz commented 8 months ago

Should I report to twitch that they have something missing in their docs ?

Yes, you should open an issue in twitchdev/issues.

I'm not quite sure what the status is trying to tell. Could be on our side or on Twitch's. Maybe it's when a reconnect (sent from Twitch) event wasn't successful, and we pass an outdated id?

Samoth69 commented 8 months ago

https://github.com/twitchdev/issues/issues/931