# klarusocket

> Socket to communicate with a response to a specific request

Latest version **1.0.8** (published 2022-08-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install klarusocket
pnpm add klarusocket
yarn add klarusocket
bun add klarusocket
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2022-08-08 |
| First published | 2022-07-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 49.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | klarulor |
| Maintainers | klarulor |

## Links

- npm: https://www.npmjs.com/package/klarusocket
- npm.io page: https://npm.io/package/klarusocket

## Dependencies (3)

- [http](https://npm.io/package/http.md) ^0.0.1-security
- [crypto](https://npm.io/package/crypto.md) ^1.0.1
- [websocket](https://npm.io/package/websocket.md) ^1.0.34

## Recent versions

- 1.0.8 (latest) — 2022-08-08
- 1.0.6 — 2022-08-08
- 1.0.4 — 2022-08-08
- 1.0.3 — 2022-07-11
- 1.0.2 — 2022-07-11
- 1.0.1 — 2022-07-11
- 1.0.0 — 2022-07-04

## README

# KlaruSocket - MultiLanguage socket
Socket to communicate with a response to a specific request

## Installation


```
$ npm install klarusocket
```
## Example
```
$ git clone https://github.com/Klarulor/KlaruSocket.ts.git --depth 1
$ cd example
```
*server.ts*
```typescript
import {KlaruSocketServer} from "../module/KlaruSocketServer";

const server: KlaruSocketServer = new KlaruSocketServer();
server.listen(1111, "127.0.0.1", () => {
    console.log("Listening");
})


server.on(`auth`, client => {
    console.log("auth");
})

server.subscribe("test", req => {
    console.log(req.data)
    req.reply("da");
})

setTimeout(async () => {
    const req = await server.getClients()[0].get("kak", "oof");
    console.log(req.content);
    //console.log(server.getClients().length)
}, 5000);
```

*client*
```typescript
import {KlaruSocketClient} from "../module/KlaruSocketClient";

const client: KlaruSocketClient = new KlaruSocketClient("da");
client.connect(1111, "127.0.0.1");


client.subscribe("kak", req => {
    console.log(req.data)
    req.reply("tak");
})


setTimeout(async () => {
    const req = await client.get("test", 100);
    console.log(req.content);
}, 1000);
```

---
_Source: https://npm.io/package/klarusocket · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
