1.0.9 • Published 4 years ago

websockio v1.0.9

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

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)
})
1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago