1.0.2 • Published 4 years ago

wskit v1.0.2

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

WSKIT

Install

yarn add wskit

Server Usage

const { WsServer, ActionHandler } = require('wskit')

class EchoActionHandler extends ActionHandler {
  static get method() { return 'echo' }

  async run(params) {
    return `ECHO ${params.message}`
  }
}

WsServer.start().then((server) => {
  server.registerActionHandler(EchoActionHandler)
})

Client Usage

const { WsClient } = require('wskit')

WsClient.start().then((client) => {
  client.action('echo', { message: 'Hello World' }).then((response) => {
    console.log(response.params.message) // returns 'ECHO Hello world'
  })
})
1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago