npm i --save nativescript-stomp-client
- Version: 0.5.0
- GitHub:
- NPM: https://www.npmjs.com/package/nativescript-stomp-client
- Downloads:
- Last Day: 0
- Last Week: 0
- Last Month: 0
nativescript-stomp-client
A stomp client for Nativescript. iOS only for now.
See nativescript-stomp-client demo for example code.
Installation
tns plugin add nativescript-stomp-client
Usage
Describe any usage specifics for your plugin. Give examples for Android, iOS, Angular if needed. See nativescript-drop-down for example.
// Create the instance
let aDelegate: StompClientCallback = <your delegate>;
let stompClient = new StompClient(aDelegate);
// connect
stompClient.openSocketWithURL('ws://<hostname>/<path>');
```)
// subscribe to a topic
let topic = "/topic/<my-topic>";
stompClient.subscribe(topic);
// disconnect
stompClient.disconnect();
API
export interface StompClientCallback {
stompClientDidDisconnect(client: StompClientCommon)
stompClientDidConnect(client: StompClientCommon)
stompClientDidReceiveMessage(client: StompClientCommon, destination: string, jsonBody: string)
serverDidSendReceipt(client: StompClientCommon, receiptId: string)
serverDidSendError(client: StompClientCommon, description: string, message: string)
serverDidSendPing();
}
Android limitations
- event
serverDidSendPingis not yet implemented sendMessage: parameterswithHeadersandwithReceiptare ignored- event
serverDidSendReceiptdoesn't contain thereceiptId(it's alwaysundefined) stompClientDidReceiveMessage: parameterdestinationis not sent (it's alwaysundefined)
TODO
- Test with more servers
- Remove Android limitations
License
Apache License Version 2.0, January 2004