2.0.7 • Published 4 years ago

rib-client v2.0.7

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

Rib-Client GitHub license npm version

Rib-Client is a client library to access the Rib backend framework. This should be coupled with rib-server to create a simple real-time application. Rib-Client allows you to call server-side functions directly from the client.

For the official github, please click here.

Example

let RibClient = require("rib-client").default // or import using the CDN https://unpkg.com/rib-client@[VERSION#]/lib/cdn.js
let myRib = new RibClient()

myRib.onConnect(async () => {
    myRib.serverFunctions.logMessage("Runs the logMessage function server side 👨🏻‍💻")
    console.log(await myRib.add(1, 2))
})

function sendMSG(msg) {
    console.log(msg)
}

myRib.exposeFunctions([sendMSG])   //  allows us to call sendMSG from the server

Documentation

The default constructor takes two parameters:

1) urlNamespace //  The server that you are connecting to
2) isSinglton   //  If true, the default value, each instentiation of RibClient will yeild the same object

onConnect: Function

Call a function after client connects to the server

onDisconnect: Function

Call a function when a client disconnects from the server

exposeFunction: Function

Expose a client side function that can be called from the rib server instance

exposeFunctions: Function

Expose an array of client side functions that can be called with a rib server instance

concealFunction: Function

Conceal a client side function where it can no longer be accessed from the server

concealFunctions: Function

Conceal client side functions where they can no longer be accessed from the server

concealFunctionsByKey: Function

Conceal client side functions by key to which they were exposed where they can no longer be accessed from the server

close: Function

Close the Rib client instance manually

2.0.7

4 years ago

2.0.6

4 years ago

2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

5 years ago

1.1.7

5 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.12

5 years ago

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago