Skip to content

Browser JS Edition

Trollhunters501PC edited this page Mar 19, 2025 · 14 revisions

Installation

In your Html add this:

<script src="https://cdn.jsdelivr.net/gh/Creadores-Program/ServerWebGamePost@1.2.1/browser/org/CreadoresProgram/ServerWebGamePost/client/ServerWebGamePostClient.js"></script>

Note

If your server does not support HTTPS, I recommend using an HTTPS proxy. SecureProxyLink is a great option that you can host for free on platforms like Vercel

Create Server

Not supported!

Create Client

Processing Datapackets

You need to create a callback function. Something like that:

function processDatapacks(datapack){
//datapack = json
}

Send Datapackets

Simply in the ServerWebGamePostClient class Execute the sendDatapacket function

Something like that:

//client = ServerWebGamePostClient
client.sendDataPacket(packet);
//packet = json
// Remember to also send the identifier key

Create Instance

You must create a new ServerWebGamePostClient instance

var client = new ServerWebGamePostClient(domain, port, isHttps);
// domain = String (server domain or IP)
// port = Number (Server port)
// isHttps= boolean (whether the server has HTTPS encryption or not)
client.processDatapacks = callback;
//callback = function(Callback in charge of handling data packets )
Clone this wiki locally