Openfire Inband registraion using strophe js in converse JS

Here i have explaining, how we can implement the in band registration using Strophe js.

First we need to download following library files and include in the html .


Here is the piece of code below and you can modify the necessary fields

<script type="text/javascript">
var BOSH_SERVICE = ''; // your openfire http-bind url
var server = '';
function register() {
	var $reg_name = 'Enter username';
	var $reg_pass = 'Enter password';
	var $fullname = 'Enter fullname';
	var $email = 'Enter email';
	var url = BOSH_SERVICE;
	connection = new Strophe.Connection(url);
	var registerCallback = function (status) {
		if (status === Strophe.Status.REGISTER) {
			console.log("registerCallback: REGISTER");
			connection.register.fields.username = $reg_name;
			connection.register.fields.password = $reg_pass; = $fullname; = $email;
		} else if (status === Strophe.Status.REGISTERED) {
			console.log("registerCallback: REGISTERED");
		} else if (status === Strophe.Status.CONNECTED) {
			console.log("registerCallback: CONNECTED");
		} else if (status === Strophe.Status.CONFLICT) {
			console.log("registerCallback: Contact already existed!");
		} else if (status === Strophe.Status.NOTACCEPTABLE) {
			console.log("registerCallback: Registration form not properly filled out.")
		} else if (status === Strophe.Status.REGIFAIL) {
			console.log("registerCallback: The Server does not support In-Band Registration")
		} else {
			// every other status a connection.connect would receive
	connection.register.connect(server, registerCallback);
$(document).ready(function() {

I hope this may help you. Thank you.

Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkedin
Share On Pinterest

Be the first to comment

Leave a Reply

Your email address will not be published.