nativescript-stomp-client
TypeScript icon, indicating that this package has built-in type declarations

0.5.0 • Public • Published

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

  1. event serverDidSendPing is not yet implemented
  2. sendMessage: parameters withHeaders and withReceipt are ignored
  3. event serverDidSendReceipt doesn't contain the receiptId (it's always undefined)
  4. stompClientDidReceiveMessage: parameter destination is not sent (it's always undefined)

TODO

  • Test with more servers
  • Remove Android limitations

License

Apache License Version 2.0, January 2004

Package Sidebar

Install

npm i nativescript-stomp-client

Weekly Downloads

0

Version

0.5.0

License

Apache-2.0

Unpacked Size

32.9 kB

Total Files

18

Last publish

Collaborators

  • demetrio812