# mikudos-socketio-client

> mikudos-socketio-client for connection and call methods and sync events on mikudos-socketio-app server, which is provided only for socket.io connection.

Latest version **0.0.8** (published 2020-04-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install mikudos-socketio-client
pnpm add mikudos-socketio-client
yarn add mikudos-socketio-client
bun add mikudos-socketio-client
```

## Health

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

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.8 |
| Published | 2020-04-24 |
| First published | 2019-11-26 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 16.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Julian Yue |
| Maintainers | yueguanyu |
| Keywords | mikudos, socket.io, client |

## Links

- npm: https://www.npmjs.com/package/mikudos-socketio-client
- Repository: https://github.com/mikudos/mikudos-socketio-client
- Homepage: https://github.com/mikudos/mikudos-socketio-client#readme
- Issues: https://github.com/mikudos/mikudos-socketio-client/issues
- npm.io page: https://npm.io/package/mikudos-socketio-client

## Dependencies (2)

- [lodash](https://npm.io/package/lodash.md) ^4.17.15
- [socket.io-client](https://npm.io/package/socket.io-client.md) ^2.3.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.8 (latest) — 2020-04-24
- 0.0.7 — 2019-12-08
- 0.0.6 — 2019-12-03
- 0.0.5 — 2019-11-28
- 0.0.4 — 2019-11-27
- 0.0.3 — 2019-11-26
- 0.0.2 — 2019-11-26
- 0.0.1 — 2019-11-26

## README

![Mikudos Client](https://img.shields.io/badge/MIKUDOS-Client-blue?style=for-the-badge&logo=appveyor)

# [![Mikudos](https://raw.githubusercontent.com/mikudos/doc/master/mikudos-logo.png)](https://mikudos.github.io/doc)

# MIKUDOS SOCKETIO CLIENT

mikudos-socketio-client for connection and call methods and sync events on mikudos-socketio-app server, which is provided only for socket.io connection.

![node version](https://img.shields.io/node/v/mikudos-socketio-client) ![version](https://img.shields.io/github/package-json/v/mikudos/mikudos-socketio-client) [![npm version](https://img.shields.io/npm/v/mikudos-socketio-client)](https://www.npmjs.com/package/mikudos-socketio-client) ![license](https://img.shields.io/npm/l/mikudos-socketio-client) ![downloads](https://img.shields.io/npm/dw/mikudos-socketio-client) ![collaborators](https://img.shields.io/npm/collaborators/mikudos-socketio-client) ![typescript](https://img.shields.io/npm/types/mikudos-socketio-client)

## Usage

Import the mikudos-socketio-client module:

```ts
import { MikudosSocketIoClient } from 'mikudos-socketio-client';
```

```js
var { MikudosSocketIoClient } = require('mikudos-socketio-client');
```

### MikudosSocketIoClient

General client for MikudosSocketIoClient:

```js & ts
const client = new MikudosSocketIoClient(
    {
        // same uri and option string will pass to socket.io generator as io(uri, option);
        uri: 'ws://localhost:3030',
        option: {}
    },
    {
        rpcEventName: 'rpc-call' // the path for remote rpc-call
    },
    token => {
        saveToken(token);
    },
    () => window.localstorage.jwt
);
```

### Authentication

Authentication the client connection.

```js
client
    .authentication({
        strategy: 'local',
        email: 'email',
        password: 'password'
    })
    .then(res => {
        console.log('TCL: res', res);
    })
    .catch(err => {
        console.log('TCL: err', err);
    });

client
    .authentication({
        strategy: 'jwt',
        accessToken: 'your_token' || 'Bearer your_token'
    })
    .then(res => {
        console.log('TCL: res', res);
    })
    .catch(err => {
        console.log('TCL: err', err);
    });
```

### Call JSON-rpc server method

```js
client
    .rpcCall({
        method: 'rpc_1.add',
        params: [1, 6],
        id: 4
    })
    .then(res => {
        console.log('TCL: res', res);
    })
    .catch(err => {
        console.log('TCL: err', err);
    });
```

# License

[MIT](LICENSE)

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