# mwebsocket

> easy to use websocket for react and use heartbeat mechanism

Latest version **1.0.0** (published 2019-04-22) · ISC license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2019-04-22 |
| First published | 2019-04-22 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Ghost60 |
| Maintainers | ghost60 |
| Keywords | websocket, heartbeat |

## Links

- npm: https://www.npmjs.com/package/mwebsocket
- Repository: https://github.com/ghost60/MWebSocket
- Homepage: https://github.com/ghost60/MWebSocket#readme
- Issues: https://github.com/ghost60/MWebSocket/issues
- npm.io page: https://npm.io/package/mwebsocket

## 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

- 1.0.0 (latest) — 2019-04-22

## README

# MWebSocket
#### websocket use heartbeat mechanism and easy to use for react

#### yarn add MWebSocket
#### import MWebSocket fron 'MWebSocket'

...
```
state = {
    data: ''
  }
  componentDidMount() {
    this.Socket = new MWebSocket('ws://123.207.167.163:9010/ajaxchattest')
    this.Socket.init()
    this.Socket.on('data', this.upDateState.bind(this))
  }
  componentWillUnmount() {
    if (this.Socket) {
      this.Socket.close()
      this.Socket.off('data', this.upDateState.bind(this))
    }
  }
  upDateState() {
    var handlerArgs = [...arguments]
    this.setState({ data: handlerArgs[0] })
  }
  ```
  ...

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