- Cheat Sheet
- Getting Started
- The Basics
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
})
Installing from NPM
npm i @syncano/client --save
Also available at UNPKG
<script src="https://unpkg.com/@syncano/client@latest/dist/index.js"></script>