What cause websocket listenKey not exist?

When I ping the key always get

{"code":-1125,"msg":"This listenKey does not exist."}

please share which endpoint returned this error and what’s the parameter sent in the request?
thanks

http PUT with headers 
headers.insert("User-Agent","Mozilla/4.0 (compatible; Node Binance API)");
headers.insert("Content-Type","application/x-www-form-urlencoded");
headers.insert("X-MBX-APIKEY", access_key);

https://api.binance.com/api/v3/userDataStream?listenKey=${listenKey}

ping every 10 minutes, always get This listenKey does not exist, then retry(generate a new key)

Why the listenKey could be invalid?

[2020-06-10T23:46:20Z ERROR ws_client::binance] binance ping error listen_key D59cIClGAX8Zi50d18YDJVomGICnysDrTSkFMi0DKY3VXLLcVKU0gSOQD275 ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-10T23:46:20Z INFO ws_client::binance] binance delete listen_key D59cIClGAX8Zi50d18YDJVomGICnysDrTSkFMi0DKY3VXLLcVKU0gSOQD275, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-10T23:56:22Z ERROR ws_client::binance] binance ping error listen_key BnsAZnsYAeCkBo0iZywA5cOEFU67WQrLmlkY52KxRByp0Ca6u36MuSzDutfF ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-10T23:56:22Z INFO ws_client::binance] binance delete listen_key BnsAZnsYAeCkBo0iZywA5cOEFU67WQrLmlkY52KxRByp0Ca6u36MuSzDutfF, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:06:25Z ERROR ws_client::binance] binance ping error listen_key W8EzoOy7IF7e8OBpccaWo2BdZqjy8lSdP6K1FcBFxIE8xPUVlcK72bVsA27b ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:06:25Z INFO ws_client::binance] binance delete listen_key W8EzoOy7IF7e8OBpccaWo2BdZqjy8lSdP6K1FcBFxIE8xPUVlcK72bVsA27b, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:16:27Z ERROR ws_client::binance] binance ping error listen_key rQldmIUyuHCRwsj7VYA0L13uCA87CT3ZxMZqP9FM8K4mzLYmCDhXgz7X9IHy ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:16:27Z INFO ws_client::binance] binance delete listen_key rQldmIUyuHCRwsj7VYA0L13uCA87CT3ZxMZqP9FM8K4mzLYmCDhXgz7X9IHy, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:26:29Z ERROR ws_client::binance] binance ping error listen_key xhy0LXhvCIDuyyrgGekMj3efy5quYKEZNmnYbCsrw2SNqITtSHhGT6Stnn7r ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:26:29Z INFO ws_client::binance] binance delete listen_key xhy0LXhvCIDuyyrgGekMj3efy5quYKEZNmnYbCsrw2SNqITtSHhGT6Stnn7r, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:36:31Z ERROR ws_client::binance] binance ping error listen_key flNqzIlPF494WjCTPPBnXZsv0ZX0iOCPYng4kyQwqqYVqDfhzTtQevdSfa4h ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:36:31Z INFO ws_client::binance] binance delete listen_key flNqzIlPF494WjCTPPBnXZsv0ZX0iOCPYng4kyQwqqYVqDfhzTtQevdSfa4h, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:46:33Z ERROR ws_client::binance] binance ping error listen_key 6ohJ0eKhkLlkLp5QklQMHOgUKUZqfTsP7qjNCbfhri2YeMFYAT1E3zwqjiSQ ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:46:33Z INFO ws_client::binance] binance delete listen_key 6ohJ0eKhkLlkLp5QklQMHOgUKUZqfTsP7qjNCbfhri2YeMFYAT1E3zwqjiSQ, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:56:35Z ERROR ws_client::binance] binance ping error listen_key czHCDbOrsZd3ztegp9MKsn6X7h0P5H3TqDRArX66V3vcKeFHJ55rhO0tT5oj ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T00:56:35Z INFO ws_client::binance] binance delete listen_key czHCDbOrsZd3ztegp9MKsn6X7h0P5H3TqDRArX66V3vcKeFHJ55rhO0tT5oj, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:06:37Z ERROR ws_client::binance] binance ping error listen_key r52na8pDYSTl6kUu2b3u7TUVFVmgCnyxTbYKHM4RAB1itd5Wjw89n7ynTO98 ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:06:37Z INFO ws_client::binance] binance delete listen_key r52na8pDYSTl6kUu2b3u7TUVFVmgCnyxTbYKHM4RAB1itd5Wjw89n7ynTO98, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:16:39Z ERROR ws_client::binance] binance ping error listen_key xCQZA3TkJ3wks2Mi51pNLeTlvQ9Zc5oIrrTIILdKOWu5t99msATbPBho5R5e ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:16:39Z INFO ws_client::binance] binance delete listen_key xCQZA3TkJ3wks2Mi51pNLeTlvQ9Zc5oIrrTIILdKOWu5t99msATbPBho5R5e, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:26:41Z ERROR ws_client::binance] binance ping error listen_key Xg9BLtqndIYaqUDVPXkMxH02t4x9SouzH5TsUXBuFkf5lfTVnNr9XhtA8Ai8 ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:26:41Z INFO ws_client::binance] binance delete listen_key Xg9BLtqndIYaqUDVPXkMxH02t4x9SouzH5TsUXBuFkf5lfTVnNr9XhtA8Ai8, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:36:43Z ERROR ws_client::binance] binance ping error listen_key FP8CQaZu4TAcHZuWxMHEMCI6ub81pxhHnWFHeHXW3Z86SaB8hsRrzzLETx7B ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:36:43Z INFO ws_client::binance] binance delete listen_key FP8CQaZu4TAcHZuWxMHEMCI6ub81pxhHnWFHeHXW3Z86SaB8hsRrzzLETx7B, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:46:45Z ERROR ws_client::binance] binance ping error listen_key iEjyBzTg20OVT9odBdeTFsCty96sDSuPgab6nPnziyH2FykuqI4K6smbKdwZ ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:46:45Z INFO ws_client::binance] binance delete listen_key iEjyBzTg20OVT9odBdeTFsCty96sDSuPgab6nPnziyH2FykuqI4K6smbKdwZ, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:56:47Z ERROR ws_client::binance] binance ping error listen_key zjQoTz6WDTdSvvdH1xVPCC6z0sr3UCHXflnFMGfLDrdVummixsE31RNlgFM7 ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T01:56:47Z INFO ws_client::binance] binance delete listen_key zjQoTz6WDTdSvvdH1xVPCC6z0sr3UCHXflnFMGfLDrdVummixsE31RNlgFM7, response {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T02:06:50Z ERROR ws_client::binance] binance ping error listen_key Bl1Egsm04dP2rrjPCVEuVOI8i4gK7vGnua2GCMDu70UC4W3qSWy9wWx0f2XZ ping expect {} but recv {"code":-1125,"msg":"This listenKey does not exist."}
[2020-06-11T02:06:50Z INFO ws_client::binance] binance delete listen_key Bl1Egsm04dP2rrjPCVEuVOI8i4gK7vGnua2GCMDu70UC4W3qSWy9wWx0f2XZ, response {"code":-1125,"msg":"This listenKey does not exist."}

it seems that this listenKey is not valid, please try to generate a new one and PUT to renew.
it should work then :slight_smile:

Sorry this log is still very limited, I’m not sure how did you get this error.
But in order to renew the listenKey, it has to send a RESTful request
PUT /api/v3/userDataStream , providing the valid listen key for the parameter listenKey.

in cURL, can be like:

curl -H "Context-Type: application/json" --request PUT 'https://api.binance.com/api/v3/userDataStream?listenKey=xxxxx'