# one-server-socketio

> > It's a toolkit for nodejs Socket.IO.

Latest version **0.0.3** (published 2023-11-01) · 0 weekly downloads

## Install

```sh
npm install one-server-socketio
pnpm add one-server-socketio
yarn add one-server-socketio
bun add one-server-socketio
```

## Health

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

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-11-01 |
| First published | 2023-10-13 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 13 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | geo.pan |

## Links

- npm: https://www.npmjs.com/package/one-server-socketio
- npm.io page: https://npm.io/package/one-server-socketio

## Dependencies (3)

- [express](https://npm.io/package/express.md) ^4.18.2
- [socket.io](https://npm.io/package/socket.io.md) ^4.7.2
- [one-server-tools](https://npm.io/package/one-server-tools.md) ^0.0.3

## Recent versions

- 0.0.3 (latest) — 2023-11-01
- 0.0.2 — 2023-10-17
- 0.0.1 — 2023-10-13

## README

> It's a toolkit for nodejs Socket.IO.

## Functions
```typescript
interface IOSocketConfig {
  port?:number; 
  https?:{
    key:string; 
    cert:string;
  },
  auth?: { 
    topic?:string; // 客户端登录验证消息的主题, 用于让服务器识别是否是登录验证的请求,默认AUTH
    secret?:string; // TOKEN的加密密钥
  }
}

/**
 * 建立HTTP(s)连接, 进行Websocket通讯
 * 支持JWT身份验证
 * 客户端Demo: 
  const socket = io('https://localhost:3030', {
    secure: true, // 指定使用安全的 HTTPS 协议
    rejectUnauthorized: false, // 如果不验证证书，设置为 true
    auth: {
      token // 将认证信息放在auth属性中
    }
  })
 */
class IOSocket {
  constructor(filename:string);
  constructor(options:IOSocketConfig);
  handle(callback:(topic:string, msg: string, io:any)=>void): this;
  start(topics:string|string[], callback:(log:string)=>void): this;
}
```

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