Skip to content

demetrio812/nativescript-stomp-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

	// 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

About

Stomp client for Nativescript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published