2016-02-05 37 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协议。