# Keep alive

1. Login 이 성공되어 있지 않다면 keepalive 호출시 websocket 연결이 자동으로 끊긴다.
2. 20초 timeout 되면 websocket 연결이 자동으로 끊긴다. 10초 주기로 keepalive 권장.

<table><thead><tr><th width="116.33333333333331">Req/Res</th><th width="452">Protocol</th><th>Desc.</th></tr></thead><tbody><tr><td>req</td><td><pre class="language-json"><code class="lang-json">{
    "type" : "REQ_KEEPALIVE",
    "data" : {
        "cur_ts" : 1666266644000
    }
}
</code></pre></td><td></td></tr><tr><td>res</td><td><pre class="language-json"><code class="lang-json">{
  "type" : "RES_KEEPALIVE",
  "data" : {
    "message" : "success",
    "return" : 0,
    "value" : {
      "cur_ts" : 1671519251949
    }
  }
}
</code></pre></td><td></td></tr><tr><td></td><td></td><td></td></tr></tbody></table>

{% tabs %}
{% tab title="Req" %}

<table><thead><tr><th width="261.2836363636364">key</th><th width="180.93023255813955">data type</th><th>desc.</th></tr></thead><tbody><tr><td>cur_ts</td><td>int64</td><td>현재 시간 (ms)</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="Res" %}

<table><thead><tr><th width="261.2836363636364">key</th><th width="180.93023255813955">data type</th><th>desc.</th></tr></thead><tbody><tr><td>cur_ts</td><td>int64</td><td>서버 응답 시간 (ms)</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
{% endtab %}

{% tab title="error Res" %}

<table><thead><tr><th width="129.66666666666666">return</th><th>message</th><th>desc.</th></tr></thead><tbody><tr><td>0</td><td>success</td><td>성공</td></tr><tr><td>71102</td><td>Not login session</td><td>로그인 하지 않은 세션</td></tr><tr><td></td><td></td><td></td></tr></tbody></table>
{% endtab %}
{% endtabs %}
