Giter VIP home page Giter VIP logo

atmosphere-stomp's Introduction

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);

atmosphere-stomp's People

Contributors

elakito avatar gdrouet avatar jfarcand avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atmosphere-stomp's Issues

Multiple encoder/decoder

@StompService allows to define multiple encoder/decoder. However we always use only one of them and ignore the others.

Parameterize destinations

Leverage parameters inside a destination.

@StompService(destination = "/stomp-destination/{object-id}")
@Message(encoders = { MyEncoder.class }, decoders = {MyDecoder.class }) 
public MyDto doStuff(final MyDto dto, @DestinationParam("object-id") String objectId) {
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.