Socket
Book a DemoInstallSign in
Socket

rib-client

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rib-client

Client library to access the rib-server framework

2.0.7
latest
npmnpm
Version published
Weekly downloads
38
1800%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

frontend

FAQs

Package last updated on 05 Jan 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.