<div class="row">
  <div class="col-lg-12">
    <h3>CppComet JWT example</h3> 
    <div class="note">
      <p> 
        <a href="https://comet-server.com/wiki/doku.php/comet:authentication">Пример авторизации через JWT токены</a> на <a href="https://github.com/CppComet/comet-server" target="_blank">CppComet</a>
      </p> 
      <p>
        Для создания тестовых токенов удобно использовать <a href="https://jwt.io/" target="_blank">jwt.io</a> или <a href="https://gist.github.com/Levhav/20c9852dacacdff3c2b70722ae7ad6bd#file-generate-jwt-token">этот php код</a>
      </p>
    </div>
    <div>
      <div class="note log" ></div> 
    </div>
    pre{
        border: 1px solid #ccc;
        padding: 5px;
        background-color: #EEE;
    }

hr{
  clear:both;
}

.hide{
  display:none;
}

.note{
  background:#eee;
  padding:10px 10px;
  margin:5px;
  border-radius:5px;
  text-align:justify;
}
 
function log()
{
    console.log(arguments);
    $(".log").prepend(JSON.stringify(arguments)+"<hr>");
} 

cometApi.start({node:"app.comet-server.ru", dev_id:15, user_id:6,    user_key:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjo2LCJleHAiOjE2ODMyMjg4MDB9.qMugS5hEKX8NZzHC6K43PNjDgLvnW35S1HbJqIDYsNY" })
      
cometApi.onAuthSuccess(function()
{
    log("Authorization on the comet server is complete")
})

cometApi.onAuthFalill(function()
{
    log("Authorization on the comet server is fail")
})

External CSS

  1. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js
  2. https://comet-server.com/CometServerApi.js
  3. https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js