Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 1.24 KB

File metadata and controls

69 lines (49 loc) · 1.24 KB

Documentation

Usage

The library supports the CommonJS syntax:

var Syncano = require('@syncano/client')

You can also use it with ES6 modules:

import Syncano from '@syncano/client'

Create a connection

To create a connection, simply initialize the Syncano object with instance name:

const s = new Syncano('INSTANCE_NAME')

You can create instance via Syncano CLI.

Call socket

s.post('socket_name/endpoint_name').then(res => {
  // Handle response
})

Call socket with parameters

s.post('socket_name/endpoint_name', {
  city: 'Warsaw'
}).then(res => {
  // Handle response
})

Installation

Installing from NPM

npm i @syncano/client --save

Also available at UNPKG

<script src="https://unpkg.com/@syncano/client@latest/dist/index.js"></script>