Skip to content

Atmosphere/atmosphere-stomp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STOMP implementation for the Atmosphere Framework

To download Atmosphere STOMP, add the following dependency:

     <dependency>
         <groupId>org.atmosphere</groupId>
         <artifactId>atmosphere-stomp</artifactId>
         <version>0.3</version>
      </dependency>

Project state

The protocol support is currently not complete and will be progressively fixed in future releases. To do this, the project will lead new CPR and Javascript enhancements to then take advantage from them.

Consequently, alpha/RC of both projects will be provided when necessary the day we need to release a new version of STOMP support. The following table shows the associated versions:

atmosphere-stomp atmosphere-runtime atmosphere-javascript
0.1 2.2.0-RC1 2.2.0
0.2 2.2.0-RC3 2.2.2
0.3 2.3.0-RC6 2.2.9

Demo

Check out our super simple demo to get started. File issues, do pull requests to help this community. Have questions? Post them here

Quick start

Using STOMP protocol over Atmosphere is very easy.

Server side code

@StompEndpoint
public class StompBusinessService {

    // Invoked when someone push a 'SEND' frame to the '/stomp-destination' destination
    @StompService(destination = "/stomp-destination")
    @Message(encoders = { MyEncoder.class }, decoders = {MyDecoder.class })
    public MyDto doStuff(final MyDto dto) {
        MyDto retval = ...
    
        // Broadcast the result to all '/stomp-destination' subscribers
        return retval;
    }
}

Client side code

// Build atmosphere request object as usual
var request = { {
    url: document.location.protocol + "//" + document.location.host + '/stomp',
    ...
};

// We use Stomp.js here
var client = Stomp.over(new $.atmosphere.WebsocketApiAdapter(request));

// Bind a callback to a subscription
client.subscribe("/stomp-destination", function(e) {
    ...
});

// Send data to the destination
var myDto = { ... };
client.send("/stomp-destination", {}, myDto);