1.0.5 • Published 3 years ago

wscc v1.0.5

Weekly downloads
-
License
GPL v3
Repository
-
Last release
3 years ago

wscc WebSocketControlerClient

npm install wscc для сервера тут

import wscc from "wscc"

const ws = new wscc("localhost", 3010, true); // true === secure
ws.socketCreate = () =>
{
    console.log("socketCreate");
    ws.send("incomingEvent", undefined)
    ws.send("incomingEvent", null)
    ws.send("incomingEvent", 12)
    ws.send("incomingEvent", "12")
    ws.send("incomingEvent", {})
    ws.send("incomingEvent",  ArrayBuffer | DataView , {descriphen  : "клієнт получе цей обєк разом із Buffer", descriphen2 : "не обов'язково"})
};
ws.disconnect = () =>
{
    console.log("disconnect");
}; 
ws.reconnecting = () =>
{
    console.log("reconnecting");
};

// підписуєшся на вхідне повідомленя
ws.on("event", (data, header) =>
{
    console.log(data, header)
    ws.removeOn("event") // тепер ця подія небуде працювать
});

setInterval(() => 
{
    console.log(ws.connected)// тіки для читаня
}, 5000);
1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago