2014-04-29 1 views
0

XMPP 서버에 새 사용자를 추가하려고합니다. 여기 strophe.register.js을 사용하고 것이 내 코드입니다XMPP - Strophe.register.js

var callback = function (status) { 
    if (status === Strophe.Status.REGISTER) { 

     connection.register.fields.username = "juliet"; 
     connection.register.fields.password = "R0m30"; 

     connection.register.submit(); 
     } 
     else if (status === Strophe.Status.REGISTERED) { 
     console.log("registered!"); 
     // calling login will authenticate the registered JID. 
     connection.register.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) { 
     console.log('logged in') 
     } else { 
     console.log("every other status a connection.connect would receive"); 
     } 
    }; 


    $("#registerBtn").click(function(){ 
     connection.register.connect("192.168.1.77/bosh/", callback, 60, 1); 

    }) 

내가 UNAME로 만든 사용자 가지고 기대하는 #registerBtn 클릭 할 때 : 줄리엣 및 전달합니다 R0m30합니다.

대신 그 난 콘솔에서이 오류를 얻을 : 형식 오류 : that._buildBody 106

내가 여기와 나는 거의 모든 XMPP-좌향 선회 연결 문제를 확인했습니다 strophe.register.js 라인에서 오는 함수가 아닙니다 솔루션을 찾을 수 없습니다.

나는이 해결책을 시도했다 : Register XMPP-Account using the Strophe.js-Register-Pluging 그러나 그것은 나를 위해 작동하지 않았다. 누구나 아이디어가 있으십니까?

답변

0

동일한 문제가 너무있었습니다. 나는 그것을 다음과 같이 수정했다 : https://github.com/strophe/strophejs-plugins/tree/master/register. 또한 connection.register.connect ("192.168.1.77/bosh/", callback, 60, 1)의 "192.168.1.77/bosh/"을 확인하십시오. ejabberd와 같은 XMPP 서버에 등록한 호스트의 이름으로 바뀝니다. 예를 들어 'example.com'또는 'localhost'등이 있습니다.