- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
let SPAM = {
"lastWsMessage": null,
"lastWsLink": null,
"specialFunctionWS": (urlws) => {
SPAM.lastWsLink = urlws;
let ws = new WebSocket(urlws);
ws.onopen = () => {
console.log("connected");
return "connected";
};
ws.onclose = () => {
console.log("disconnected");
return "disconnected";
};
ws.onerror = () => {
console.log("error");
return "error";
};
ws.onmessage = (event) => {
console.log("message ${event.data}");
SPAM.lastWsMessage = event.data;
};
},
"spammer": (text, amount) => {
for(let a = 0; a < amount; a++) {
console.log(text);
};
return amount;
},
"wsConnecting": (url) => {
let splitter = url.split(":");
if(splitter[0] == "ws") {
console.log("WARNING: it is not advised to use the value \"ws\"!");
SPAM.specialFunctionWS(url);
};
if(splitter[0] == "wss") {
SPAM.specialFunctionWS(url);
};
if(splitter[0] == "http" || splitter[0] == "https") {
console.log("WARNING: don't use the values http/https for socket connecting!\nLink changed: wss://" + url);
SPAM.specialFunctionWS("wss://" + url);
};
if(splitter.length == 1) {
console.log("WARNING: script is using the value \"wss\"!");
SPAM.specialFunctionWS("wss://" + url);
};
},
"SendWs": (message) => {
if(SPAM.lastWsLink != null) {
let ws = new WebSocket(SPAM.lastWsLink);
ws.onopen = () => {
console.log("connected");
return "connected";
};
ws.onclose = () => {
console.log("disconnected");
return "disconnected";
};
ws.onerror = () => {
console.log("error");
return "error";
};
ws.onmessage = (event) => {
console.log("message ${event.data}");
SPAM.lastWsMessage = event.data;
};
} else {
console.log("ERROR: last connection not found!");
};
}
};