3.2.0 • Published 9 years ago

soso-client v3.2.0

Weekly downloads
4
License
ISC
Repository
github
Last release
9 years ago

Soso client

Comfortable, fast, bidirectional protocol over websocket instead REST

soso-server

###Install

  npm install --save soso-client

  // or use in browser with rawgit

  <script src="https://cdn.rawgit.com/happierall/soso-client/master/dist/soso-client.min.js"></script>

###Usage

  import Soso from 'soso-client'

  var soso = new Soso("ws://localhost:4000/soso")

  // Request
  soso.onopen = () => {

    soso.request("user", "retrieve", { id: 1 }).then(data => {
      console.log(data.response_map)
    })

  }

  // Just send
  soso.send("post", "like", { post_id: 5 })

  // Handle request from Server
  soso.handle("user", "CREATED", data => {
    console.log(data)
  })
  //Events
  soso.onopen = (e) => {}
  soso.onclose = (e) => {}
  soso.onmessage = (data) => {}
  soso.ondirectmsg = (data) => {}
  soso.onerror = (e) => {}
  // Disabled logs
  soso.log = false // Default true
  // Short requests
  soso.get("user")
  soso.search("user")
  soso.create("user")
  soso.update("user")
  soso.delete("user")
  soso.flush("user")
3.2.0

9 years ago

3.1.0

9 years ago

3.0.6

9 years ago

3.0.5

9 years ago

3.0.4

9 years ago

3.0.3

9 years ago

3.0.2

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

1.0.6

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago