package
Node.js SDK of TWS (Teambition Web Service) cloud messaging service.
npm install tws-tcmGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Node.js SDK of TWS (Teambition Web Service) cloud messaging service.
npm i --save tws-tcm'use strict'
const { TCMClient } = require('tws-tcm')
;(async function () {
const client = new TCMClient({
host: process.env.TCM_HOST,
appId: process.env.APP_ID,
appSecrets: [process.env.APP_SECRET]
})
// HTTP
await client.subscribe('some_topic', 'some_session_id')
await client.send([{
to: 'some_topic',
collapse_key: 'collapse_key',
time_to_live: 60,
data: 'data1'
}, {
to: 'some_topic',
const { TCMClient } = require('tws-tcm')String : The ID of your TWS application.[]String : The secret passwords of your TWS application.String : Host URL of TCM service.Number : Optional, requst timeout in milliseconds, by default is 3000.Buffer : Optional, the client root certificate.Buffer : Optional, the client certificate private key.Buffer : Optional, the client certificate cert chain.Number : Optional, the client sockets.Boolean : Optional, enable timing for request.Number : Optional, delay time for retry, default to 200 ms.Number : Optional, max attempts for a request, default to 3 times.[]String : Optional, error codes that should retry, default to ['ECONNRESET', 'ENOTFOUND', 'ESOCKETTIMEDOUT', 'ETIMEDOUT', 'ECONNREFUSED', 'EHOSTUNREACH', 'EPIPE', 'EAI_AGAIN']./**
* Client for TWS (Teambition Web Service) cloud messaging service..
*/
export declare class TCMClient {
private _client;
constructor(options: TCMOptions);
/**
* subscribe a topic with given sessionId.
* @param topic message topic.
* @param sessionId user session ID.
*/
subscribe(topic: string, sessionId: string): Promise<void>;
/**
* unsubscribe a topic with given sessionId.
* @param topic message topic.
* @param sessionId user session ID.
tws-tcm is licensed under the MIT license.
Copyright © 2017-2019 Teambition.
zensh
admin@zensh.com
Estimated unpacked size across 43 packages.
2.1 MB
Includes dependencies.
3 direct dependencies.