hitbtc-com / hitbtc-api

HitBTC API
GNU Lesser General Public License v3.0
322 stars 152 forks source link

Websocket connection closed (1006 - Underlying connection closed) #249

Open smamet opened 3 years ago

smamet commented 3 years ago

I am having more and more disconnections when opening more and more websockets - 1 per pair - Multiple users - max 10 websockets per user.

Total websockets on 7 users (each api key linked to different hitbtc account) : 50 websockets.

` // 2) Subscribe to order reports to keep us updated on statuses $conn->send(json_encode([ 'method' => 'subscribeReports', 'params' => [], 'id' => 'reports', ]));

     // 3) Request OrderBook
     $conn->send(json_encode([
        'method' => 'subscribeOrderbook',
         'params' => [
            'symbol' => $this->pair
         ],
     'id' => 'orderbook',
     ]));`

If I have a little users, then very little disconnections. More user => More disconnections with 1006 - Underlying connection closed

System updates the local orderbook on realtime at each message from subscribeOrderbook and Creates / Cancels order via websocket methods.

Max replacement rate for 1 bot: 4 per second. So if 1 user has 10 bots max : 40 per sec (limit is 300 per sec on hitbtc).

NEVER RECEIVED ANY 429. Only 1006, so I think it is maybe a firewall cutoff or something.

Logs : ` [2020-10-18T21:26:22.519212+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°5/5)

[2020-10-18T21:29:22.517092+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°1/5) - After 3 min

[2020-10-18T21:32:01.930475+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°2/5) - After 3 min

[2020-10-18T21:38:01.932315+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°3/5) - After 6 min

[2020-10-18T21:41:01.929061+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°4/5) - After 3 min

[2020-10-18T21:54:31.608101+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°5/5) - After 3 min

[2020-10-18T21:55:02.261945+04:00] BOT N°36 (CELBTC).INFO: Launching bot - exec: 16783

[2020-10-18T22:27:41.917720+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°1/5) - After 32 min

[2020-10-18T22:32:41.910159+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°2/5) - After 3 min

[2020-10-18T22:49:22.621378+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°3/5) - After 17 min

[2020-10-18T23:03:02.464492+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°4/5) - After 14 min

[2020-10-18T23:08:02.456644+04:00] BOT N°36 (CELBTC).INFO: Websocket connection closed (1006 - Underlying connection closed). Reconnecting in 1 second(s) ... (Retry N°5/5) - After 5 min `

smamet commented 3 years ago

https://github.com/hitbtc-com/hitbtc-api/issues/206#issuecomment-424312655

We pull data quickly to setup the orderbook and don't unsubscribe from anything. We just randomly get cut out, sometimes after a few hours, sometime after a few minutes. Most of the cutoff are done at the exact same moment