# @samlior/socket-io-client

> `@samlior/socket-io-client` is a socketIO client based on JSONRPC.

Latest version **2.0.1** (published 2023-10-12) · GPL-3.0-or-later license · 0 weekly downloads

## Install

```sh
npm install @samlior/socket-io-client
pnpm add @samlior/socket-io-client
yarn add @samlior/socket-io-client
bun add @samlior/socket-io-client
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2023-10-12 |
| First published | 2023-01-19 |
| Weekly downloads | 0 |
| License | GPL-3.0-or-later |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 25.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | samlior |
| Maintainers | samlior_ |

## Links

- npm: https://www.npmjs.com/package/@samlior/socket-io-client
- Repository: https://github.com/samlior/framework
- Homepage: https://github.com/samlior/framework#readme
- Issues: https://github.com/samlior/framework/issues
- npm.io page: https://npm.io/package/@samlior/socket-io-client

## Dependencies (3)

- [yallist](https://npm.io/package/yallist.md) ^4.0.0
- [@samlior/utils](https://npm.io/package/@samlior/utils.md) ^2.0.1
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^4.5.4

## Recent versions

- 2.0.1 (latest) — 2023-10-12
- 2.0.0 — 2023-09-07
- 1.0.4 — 2023-01-28
- 1.0.3 — 2023-01-27
- 1.0.2 — 2023-01-26
- 1.0.1 — 2023-01-23
- 1.0.0 — 2023-01-19

## README

# `@samlior/socket-io-client`

`@samlior/socket-io-client` is a socketIO client based on JSONRPC.

## Install

```sh
npm install @samlior/socket-io-client
```

## Usage

```ts
import {
  SocketIOClientManager,
  ISocketIOHandler,
} from "@samlior/socket-io-client";

class MockClientEchoHandler implements ISocketIOHandler {
  async handle(params: any): Promise<string> {
    if (typeof params !== "string") {
      throw new Error("invalid params");
    }
    return "from client " + params;
  }
}

async function main() {
  const manager = new SocketIOClientManager();
  const client = await manager.connect("wss://aaa.bbb.ccc/namespace");
  console.log("response:", await client.req("method", "params"));
  client.close();
}

main().catch((err) => console.log("main, catch error:", err));
```

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