1.8.0 • Published 5 years ago

ws-client-server v1.8.0

Weekly downloads
4
License
Apache-2.0
Repository
github
Last release
5 years ago

UWS Server and Client Wrappers

Provides two classes:

  • WsServer({ server, port })

    WsServer wraps native WebSocket.Server. It stores connected clients in clients array and fires 'connection' event on every connected client and wraps it in WsClient. On client disconnect it removes it from clients array.

  • WsClient()

    WsClient wraps native WebSocket and provides a way to use it like socket.io (with promises)

    • Methods:
      • setInterceptor
      • say(eventName, data = {}) - send message to server without waiting for response
      • ask(eventName, data = {}) -> Promise - send message to server with response
      • on(eventName, handler) - subscribe to system events like 'open' or 'close'
      • onSay(eventName, handler) - subscribe to custom events like server broadcast
      • onAsk - same as onSay for now
      • close - disconnect from server
      • connect(connectionString) - connect to server
1.8.0

5 years ago

1.7.2

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.2

5 years ago

1.4.1

5 years ago

1.4.0

5 years ago

1.3.3

5 years ago

1.3.2

5 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago