All Projects → NaikSoftware → Stompprotocolandroid

NaikSoftware / Stompprotocolandroid

Licence: mit
STOMP protocol via WebSocket for Android

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Stompprotocolandroid

Ng2 Stompjs
Angular 6 and 7 - Stomp service over Websockets
Stars: ✭ 170 (-63.6%)
Mutual labels:  stomp
spring-websocket-angular6
Example for using Spring Websocket and Angular with Stomp Messaging
Stars: ✭ 18 (-96.15%)
Mutual labels:  stomp
docs
Enterprise Open Source IM Solution
Stars: ✭ 18 (-96.15%)
Mutual labels:  stomp
ng-stomp
📑 STOMP for AngularJS
Stars: ✭ 42 (-91.01%)
Mutual labels:  stomp
rx-stomp
STOMP adaptor for RxJS
Stars: ✭ 76 (-83.73%)
Mutual labels:  stomp
rabbitmq-web-stomp-examples
www.rabbitmq.com/
Stars: ✭ 90 (-80.73%)
Mutual labels:  stomp
Laravel Queue
Laravel Enqueue message queue extension. Supports AMQP, Amazon SQS, Kafka, Google PubSub, Redis, STOMP, Gearman, Beanstalk and others
Stars: ✭ 155 (-66.81%)
Mutual labels:  stomp
Webstomp Client
Stomp client over websocket for browsers
Stars: ✭ 280 (-40.04%)
Mutual labels:  stomp
demo-spring-websocket
'WebSockets with Spring: HTTP and WebSocket; WebSocket with SockJS fallback; STOMP over WebSocket' articles and source code.
Stars: ✭ 30 (-93.58%)
Mutual labels:  stomp
ng4-stompjs-demo
A sample using Angular4, Angular CLI and @stom/ng2-stompjs
Stars: ✭ 20 (-95.72%)
Mutual labels:  stomp
ng2-stompjs-demo
Angular 2 demo using stomp.js in Typescript
Stars: ✭ 42 (-91.01%)
Mutual labels:  stomp
spring-boot-vuejs-websockets
✔️ Simple spring-boot vue.js app with websockets and docker support
Stars: ✭ 30 (-93.58%)
Mutual labels:  stomp
rabbitmq-stomp
RabbitMQ STOMP plugin
Stars: ✭ 49 (-89.51%)
Mutual labels:  stomp
Enqueue Bundle
[READ-ONLY] Message queue bundle for Symfony. RabbitMQ, Amazon SQS, Redis, Service bus, Async events, RPC over MQ and a lot more
Stars: ✭ 233 (-50.11%)
Mutual labels:  stomp
spring-websocket-template
Template project for configuring websockets with spring
Stars: ✭ 32 (-93.15%)
Mutual labels:  stomp
Enqueue Dev
Message Queue, Job Queue, Broadcasting, WebSockets packages for PHP, Symfony, Laravel, Magento. DEVELOPMENT REPOSITORY - provided by Forma-Pro
Stars: ✭ 1,977 (+323.34%)
Mutual labels:  stomp
spring-boot-chatrooms
Spring Boot chatroom with multiple rooms using STOMP over websockets.
Stars: ✭ 33 (-92.93%)
Mutual labels:  stomp
Stompjs
Javascript and Typescript Stomp client for Web browsers and node.js apps
Stars: ✭ 324 (-30.62%)
Mutual labels:  stomp
khiva-ruby
High-performance time series algorithms for Ruby
Stars: ✭ 27 (-94.22%)
Mutual labels:  stomp
ng2-STOMP-Over-WebSocket
STOMP Over WebSocket service for angular2
Stars: ✭ 35 (-92.51%)
Mutual labels:  stomp

STOMP protocol via WebSocket for Android

Release

Overview

This library provide support for STOMP protocol https://stomp.github.io/ At now library works only as client for backend with support STOMP, such as NodeJS (stompjs or other) or Spring Boot (SockJS).

Add library as gradle dependency

repositories { 
    jcenter()
    maven { url "https://jitpack.io" }
}
dependencies {
    implementation 'com.github.NaikSoftware:StompProtocolAndroid:{latest version}'
}

Example backend (Spring Boot)

WebSocketConfig.groovy

@Configuration
@EnableWebSocket
@EnableWebSocketMessageBroker
class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer {

    @Override
    void configureMessageBroker(MessageBrokerRegistry config) {
        config.enableSimpleBroker("/topic", "/queue", "/exchange");
//        config.enableStompBrokerRelay("/topic", "/queue", "/exchange"); // Uncomment for external message broker (ActiveMQ, RabbitMQ)
        config.setApplicationDestinationPrefixes("/topic", "/queue"); // prefix in client queries
        config.setUserDestinationPrefix("/user");
    }

    @Override
    void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/example-endpoint").withSockJS()
    }
}

SocketController.groovy

@Slf4j
@RestController
class SocketController {

    @MessageMapping('/hello-msg-mapping')
    @SendTo('/topic/greetings')
    EchoModel echoMessageMapping(String message) {
        log.debug("React to hello-msg-mapping")
        return new EchoModel(message.trim())
    }
}

Check out the full example server https://github.com/NaikSoftware/stomp-protocol-example-server

Example library usage

Basic usage

 private StompClient mStompClient;
 
 // ...
 
 mStompClient = Stomp.over(Stomp.ConnectionProvider.OKHTTP, "ws://10.0.2.2:8080/example-endpoint/websocket");
 mStompClient.connect();
  
 mStompClient.topic("/topic/greetings").subscribe(topicMessage -> {
     Log.d(TAG, topicMessage.getPayload());
 });
  
 mStompClient.send("/topic/hello-msg-mapping", "My first STOMP message!").subscribe();
  
 // ...
 
 mStompClient.disconnect();

See the full example https://github.com/NaikSoftware/StompProtocolAndroid/tree/master/example-client

Method Stomp.over consume class for create connection as first parameter. You must provide dependency for lib and pass class. At now supported connection providers:

  • org.java_websocket.WebSocket.class ('org.java-websocket:Java-WebSocket:1.3.0')
  • okhttp3.WebSocket.class ('com.squareup.okhttp3:okhttp:3.8.0')

You can add own connection provider. Just implement interface ConnectionProvider. If you implement new provider, please create pull request :)

Subscribe lifecycle connection

mStompClient.lifecycle().subscribe(lifecycleEvent -> {
    switch (lifecycleEvent.getType()) {
    
        case OPENED:
            Log.d(TAG, "Stomp connection opened");
            break;
            
        case ERROR:
            Log.e(TAG, "Error", lifecycleEvent.getException());
            break;
            
        case CLOSED:
             Log.d(TAG, "Stomp connection closed");
             break;
    }
});

Library support just send & receive messages. ACK messages, transactions not implemented yet.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].