1.2.2 • Published 3 years ago

smartsupp-websocket v1.2.2

Weekly downloads
17
License
MIT
Repository
github
Last release
3 years ago

Official Smartsupp websocket SDK for JavaScript

Installation

npm install --save smartsupp-websocket
yarn add smartsupp-websocket

Usage

Create and initialize websocket client and connect to the server.

import { createVisitorClient } from 'smartsupp-websocket'

const client = createVisitorClient({
    data: {
        id: null, // null or id returned from server
        key: '__SMARTSUPP_ACCOUNT_KEY__',
        // ...
    },
})

// connect to server
client.connect().then((data) => {
    console.log(data)
})

// received events
client.on('chat.message_received', (message) => {
    console.log(message)
})

Custom Promise Library

Customize promise library:

import * as smartsuppWebsocket from 'smartsupp-websocket'
smartsuppWebsocket.setPromiseLibrary(Promise)

Development

VuePress docs hot reload workaround:

npx npm-force-resolutions
npm install
1.2.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.0

4 years ago

1.0.0

4 years ago