PageSourceSearch

https://streameta.com/scripts/network.js?v=1-3-3

js streameta.com collected 2026-10-04 06:47:24 UTC 2,534 bytes, 134 lines download raw bytes

1var socket, heartbeat;
2
3function initWebsocket(repeat = 0)
4{
5	var host,
6		updateButton = document.querySelector("#update");
7
8	if (location.protocol == "https:")
9	{
10		host = "wss://ws." + location.hostname + ":443";
11	}
12	else
13	{
14		host = "ws://" + location.hostname + ":9000";
15	}
16
17	socket = new WebSocket(host);
18
19	socket.sendMsg = function (msg, rpt = 0)
20	{
21		if (this.readyState === this.OPEN)
22		{
23			this.send(msg);
24		}
25		else if (rpt < 2 && repeat < 2)
26		{
27			initWebsocket(repeat + 1);
28			fetchData();
29			setTimeout(() => socket.sendMsg(msg, rpt + 1), 2000);
30		}
31	};
32
33	heartbeat = setInterval(() => socket.sendMsg(""), 55000);
34
35	log('WebSocket - status ' + socket.readyState);
36
37	socket.addEventListener("open", function ()
38	{
39		log("Welcome - status " + this.readyState);
40		socket.send(document.documentElement.dataset.token);
41
42		if (updateButton && updateButton.dataset.status == "disconnected")
43		{
44			delete updateButton.dataset.status;
45		}
46	});
47
48	socket.addEventListener("message", function (msg)
49	{
50		var data = msg.data;
51		/*if (data.startsWith("obs "))
52		{
53			if (window.location.pathname.includes("overlay") && location.host.startsWith("ns."))
54			{
55				sendOBSMessage(data.replace("obs ", ""));
56			}
57		}
58		else
59		{*/
60		data = data.substr(0, data.lastIndexOf("-"));
61		fetchData(data);
62		// }
63		log(msg, data);
64	});
65
66	/*socket.addEventListener("error", function()
67	{
68		log("Error - status "+this.readyState);
69	});*/
70
71	socket.addEventListener("close", function ()
72	{
73		log("Disconnected - status " + this.readyState);
74
75		clearInterval(heartbeat);
76
77		if (updateButton)
78		{
79			updateButton.dataset.status = "disconnected";
80		}
81
82		// if (getRoot() != '/streameta/com/')
83		if (repeat < 2)
84		{
85			setTimeout(() => initWebsocket(repeat + 1), 2000);
86		}
87	});
88}
89
90function ajax(url, callback, data = null)
91{
92	return new Promise(function (resolve, reject)
93	{
94		var method = (data !== null) ? "POST" : "GET",
95			xhr = new XMLHttpRequest();
96
97		if (callback !== undefined)
98		{
99			xhr.onreadystatechange = function ()
100			{
101				if (this.readyState == xhr.DONE)
102				{
103					if (this.status != 404)
104					{
105						resolve(callback(this.responseText));
106					}
107				}
108			};
109		}
110		else
111		{
112			xhr.onload = function ()
113			{
114				resolve();
115			}
116		}
117
118		xhr.open(method, url, true);
119
120		// log(typeof data);
121
122		if (typeof data === 'object' && !(data instanceof FormData))
123		{
124			data = objToUrlEncode(data);
125		}
126
127		if (typeof data === 'string')
128		{
129			xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
130		}
131
132		xhr.send(data);
133	});
134}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.