# websockio

> simple wrapper around Browser WebSocket re-implemented with socket.io style highly suitable for ws module

Latest version **1.0.9** (published 2020-03-23) · ISC license · 0 weekly downloads

## Install

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

## 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.9 |
| Published | 2020-03-23 |
| First published | 2020-03-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 12.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Shivansh Talwar |
| Maintainers | shivanshtalwar0 |
| Keywords | WebSocket, ws, Browser, Socket.io |

## Links

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

## 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.9 (latest) — 2020-03-23
- 1.0.8 — 2020-03-23
- 1.0.7 — 2020-03-23
- 1.0.6 — 2020-03-23
- 1.0.5 — 2020-03-23
- 1.0.4 — 2020-03-23
- 1.0.3 — 2020-03-23
- 1.0.2 — 2020-03-23
- 1.0.1 — 2020-03-23
- 1.0.0 — 2020-03-23

## README

## WebSockIo
Simple yet beautiful wrapper around native WebSocket similar to socket.io.  
Why restrict yourself to socket.io for websocket when you can experience similar api but with more flexibility and fine control.  

### API
#### Constructor
    WebSockIo(url:string)


#### Methods        
    close(): void

    emit(socketEvent: string, data: any): void

    off(socketEvent: string, listener: EventListener, capture: boolean): void

    on(socketEvent: string, listener: EventListener): void;
 
#### Examples
    import WebSockIo from "websockio";
    
    let wsio = new WebSockIo("ws://127.0.0.1:3000/socket")
    wsio.emit("replyme", {cool: "cool stuff", number: 88})
    wsio.on("hello", (event) => {
        //data property of every event is attached to details on event object
        let data = event.details
        console.log(data)
    })

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