1.1.6 • Published 6 years ago

v-spot-ws v1.1.6

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

v-spot-ws

Build Status npm Version JS Standard

Web socket impl of v-spot

Installation

$ npm install v-spot-ws --save

Usage

'use strict'

const vSpotWS = require('v-spot-ws')

async function tryExample () {
  const port = 8080
  const Spot = vSpotWS()

  const NewYork = vSpotWS.clinet()
  const Japan = vSpotWS.clinet()

  await Spot.listen(port)

  await NewYork.connect(`http://localhost:${port}`)
  await Japan.connect(`http://localhost:${port}`)

  {
    class Person {
      async hi (msg) {
        return `hi, ${msg}`
      }
    }

    // Create a instance to a spot
    const john = NewYork.load(Person, 'jp.realglobe.new-york.john')
    await john.hi('I am in NewYork!')
  }

  {
    // Use remote instance
    const john = await Japan.use('jp.realglobe.new-york.john')
    await john.hi('Calling from Japan!')
  }
}

tryExample().catch((err) => console.error(err))

API Guide

License

This software is released under the MIT License.

Links

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago