somata-websocket-client

0.1.1 • Public • Published

somata-websocket-client

Make Somata service calls and subscriptions from the browser using native WebSocket (which means it works with React Native). Pairs well with somata-websocket-server. Remote calls and subscriptions are returned as Kefir streams.

Installation

npm install somata-websocket-client

Usage

Create a client by providing the connection address. Use client.connected$ to wait until the connection is established.

somata = require('somata-websocket-client')
client = somata('ws://192.168.0.115:5555')
 
client.connected$.onValue ->
    client.remote('hello''sayHello').onValue (response) ->
        console.log response
 
    client.subscribe('announcer''announce').onValue (announcement) ->
        console.log announcement

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.1.1
    1
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.1.1
    1
  • 0.1.0
    1

Package Sidebar

Install

npm i somata-websocket-client

Weekly Downloads

2

Version

0.1.1

License

none

Last publish

Collaborators

  • spro