<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/strophe.js/1.2.14/strophe.js"></script>
</head>
<body>
<h1>Hello Plunker!</h1>
<input type="text" id="chat_input">
<input type="submit" id="chat_submit_button">
</body>
<script src="script.js"></script>
</html>
// Code goes here
$(document).ready(function(){
console.log("I am admin");
var onMessage = function(stanza){
console.log("recieved stanza" + stanza);
}
var conn = new Strophe.Connection("https://jabber.shawacademy.com:5280/http-bind/");
conn.connect("admin@jabber.shawacademy.com","2June1989!", function(status, error){
if(status == Strophe.Status.CONNECTED){
conn.addHandler("onMessage", null, "message", null,null,null);
//console.log("connection is ready");
var uniqueID = conn.getUniqueId("my:code");
//var reqChannelsItems = $msg({"id":uniqueID, "to":"amit@jabber.shawacademy.com"}).c("body").t("hello amit");
//conn.send(reqChannelsItems.tree());
//console.log("message sent");
var o = {to:'chat-room33@conference.jabber.shawacademy.com'};
var m = $pres(o);
m.c('x', {xmlns : 'http://jabber.org/protocol/muc#owner'}, null);
conn.send(m.tree());
o = {to : 'chat-room33@conference.jabber.shawacademy.com', type:"set" , id:uniqueID};
m = $iq(o);
m.c('query',{xmlns : 'http://jabber.org/protocol/muc#owner'}, null).
c('x',{xmlns:'jabber:x:data', type:'submit'}).
c('field',{var:'FORM_TYPE'}).c('value',{},"http://jabber.org/protocol/muc#roomconfig").
up().c('field',{var:'muc#roomconfig_persistentroom'}).c('value',{},1);
conn.send(m.tree());
//o = {to:'chat-room33@conference.jabber.shawacademy.com', type : 'groupchat'};
//m = $msg(o); m.c('body', null, 'hello bbye bbye');
//conn.send(m.tree());
}
});
});
/* Styles go here */