2016-02-05 2 views
0

Я получаюрегистр через strophe.register.js не работает

TypeError: that._buildBody is not a function error.

Я использую https://github.com/strophe/strophejs-plugins/tree/master/register

<script type="text/javascript" src="/Static/js/strophe.min.js"></script> 
<script type="text/javascript" src="/Static/js/strophe.register.js"></script> 
<script type="text/javascript"> 
$(document).ready(function() { 
    connection = new Strophe.Connection("ws://127.0.0.1:5280/websocket"); 
    var callback = function (status) { 
     if (status === Strophe.Status.REGISTER) { 
      // fill out the fields 
      connection.register.fields.username = "abcd"; 
      connection.register.fields.password = "abcd"; 
      // calling submit will continue the registration process 
      connection.register.submit(); 
     } else if (status === Strophe.Status.REGISTERED) { 
      console.log("registered!"); 
      // calling login will authenticate the registered JID. 
      connection.authenticate(); 
     } else if (status === Strophe.Status.CONFLICT) { 
      console.log("Contact already existed!"); 
     } else if (status === Strophe.Status.NOTACCEPTABLE) { 
      console.log("Registration form not properly filled out.") 
     } else if (status === Strophe.Status.REGIFAIL) { 
      console.log("The Server does not support In-Band Registration") 
     } else if (status === Strophe.Status.CONNECTED) { 
      // do something after successful authentication 
     } else { 
      // Do other stuff 
     } 
    }; 
    connection.register.connect("Vostro-3558-PC", callback, 60, 1); 
}); 
</script> 
+0

я использую выше strope.register.js регистрации – abhijit

+0

Проверьте мой ответ здесь http://stackoverflow.com/questions/34994662/strophe-register-plugin/35055565#35055565 – beaver

+0

спасибо большое !!! – abhijit

ответ

1

Я просто сталкивался с этим сам. Мне кажется, что strophe.register.js не работает с websockets - функция _buildBody специфична для протокола BOSH.

Смежные вопросы