WebSockets (Socket.io) automatically disconnects using heroku, should I scale?

My app is built using ExpressJS, AngularJS, and socket.io on a heroku server.

Initially, my client continued to disconnect from heroku error code H12 . I thought my processes worked too long, but I followed the advice and reduced the ping socket.io interval to 10 seconds and the ping timeout to 25 seconds. My outages occur less frequently after making this change.

Although the server only supports 4-5 clients, disconnections still occur. My application is a simple poker card game, which, it seems to me, does not require intensive calculations. At the same time, disconnecting is highly undesirable because it is a real-time game. I also handled most of the static assets using the AWS cloud cloud CDN. Therefore, I am wondering if I need to update my Dyno hero's CPU or need to increase the number of Dynos as well.

Are there any other settings that I have to do on my socket.io, such as pingintervals and pingtimeouts. Or should I increase / increase my Dynos on Heroku? Sorry for a little understanding of server optimization. Thank you so much for your help!

The following are the LOGs for regular ping intervals in which no events occur. In this case, no deep processing should occur, but as shown in the logs, the GET method took about 12 seconds (Heroku will disconnect when it passes 30 seconds).

2015-02-05T09: 08: 59.637350 + 00: 00 heroku [router]: at = info method = POST path = "/socket.io/?EIO=3&transport=polling&t=1423127340014-73& sid = MOLTkQP1knsflhZ3AAAB" host = daidi. herokuapp.com request_id = 8faf8459-dfb3-4c3b-a7e2-6528c0ab9850 fwd = "42.60.78.220" dyno = web.1 connect = 2ms service = 3ms status = 200 bytes = 255

2015-02-05T09: 09: 12.074210 + 00: 00 heroku [router]: at = info method = GET path = "/socket.io/?EIO=3&transport=polling&t=1423127340438-25& sid = _5fURAV8_Gn5736HAAAC" host = daidi.herokuapp.com request_id = b54dedb6-1733-414a-8fd3-b8d8fd1f4516 fwd = "42.60.78.220" dyno = web.1 connect = 1ms service = 12008ms status = 200 bytes = 207

+4
1

4-5 ( ). , , , . , , , , .

(strongloop, nodetime, , , ), //. event-loop-lag , , - .

, , socket.io . , .., , ( , ) , - . , , . , , ... H12s .

0

All Articles