MCPcopy Index your code
hub / github.com/Atmosphere/atmosphere-play

github.com/Atmosphere/atmosphere-play @play-project-3.0.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release play-project-3.0.0 ↗ · + Follow
54 symbols 122 edges 9 files 1 documented · 2% updated 4mo ago★ 887 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Playtosphere: Atmosphere for Play!

This project brings the Atmosphere Framework to the Play! Framework. It support ALL Atmosphere's modules like Runtime, Jersey and Socket.IO.

   % sbt update
   % sbt run

JDK8

Download Atmosphere Play!, use Maven or sbt

For Atmosphere 3.0+:

     <dependency>
         <groupId>org.atmosphere</groupId>
         <artifactId>atmosphere-play</artifactId>
         <version>3.0.0</version>
     </dependency>

For Play 2.8.x+ and Atmosphere 2.7+:

     <dependency>
         <groupId>org.atmosphere</groupId>
         <artifactId>atmosphere-play</artifactId>
         <version>2.6.0</version>
     </dependency>

Server side using atmosphere-runtime

@ManagedService(path = "/chat")
public class Chat {
    private final Logger logger = LoggerFactory.getLogger(Chat.class);

    /**
     * Invoked when the connection as been fully established and suspended, e.g ready for receiving messages.
     *
     * @param r
     */
    @Ready
    public void onReady(final AtmosphereResource r) {
        logger.info("Browser {} connected.", r.uuid());
    }

    /**
     * Invoked when the client disconnect or when an unexpected closing of the underlying connection happens.
     *
     * @param event
     */
    @Disconnect
    public void onDisconnect(AtmosphereResourceEvent event) {
        if (event.isCancelled()) {
            logger.info("Browser {} unexpectedly disconnected", event.getResource().uuid());
        } else if (event.isClosedByClient()) {
            logger.info("Browser {} closed the connection", event.getResource().uuid());
        }
    }

    /**
     * Simple annotated class that demonstrate how {@link org.atmosphere.config.managed.Encoder} and {@link org.atmosphere.config.managed.Decoder
     * can be used.
     *
     * @param message an instance of {@link Message}
     * @return
     * @throws IOException
     */
    @org.atmosphere.config.service.Message(encoders = {JacksonEncoder.class}, decoders = {JacksonDecoder.class})
    public Message onMessage(Message message) throws IOException {
        logger.info("{} just send {}", message.getAuthor(), message.getMessage());
        return message;
    }

and on the client side,

    $(function () {
        "use strict";

        var header = $('#header');
        var content = $('#content');
        var input = $('#input');
        var status = $('#status');
        var myName = false;
        var author = null;
        var logged = false;
        var socket = $.atmosphere;
        var subSocket;
        var transport = 'websocket';

        // We are now ready to cut the request
        var request = { url: document.location.toString() + 'chat',
            contentType : "application/json",
            logLevel : 'debug',
            transport : transport ,
            trackMessageLength : true,
            fallbackTransport: 'websocket'};


        request.onMessage = function (response) {

             // do something
        };

        request.onClose = function(response) {
        };

        request.onError = function(response) {
        };

        subSocket = socket.subscribe(request);

Extension points exported contracts — how you extend this code

PlayInternal (Interface)
@author Jeanfrancois Arcand [1 implementers]
module/src/main/java/org/atmosphere/play/PlayInternal.java
OutStream (Interface)
(no doc) [2 implementers]
module/src/main/java/org/atmosphere/play/OutStream.java
AtmospherePlaySessionConverter (Interface)
(no doc)
module/src/main/java/org/atmosphere/play/AtmospherePlaySessionConverter.java

Core symbols most depended-on inside this repo

framework
called by 8
module/src/main/java/org/atmosphere/play/AtmosphereCoordinator.java
close
called by 6
module/src/main/java/org/atmosphere/play/OutStream.java
request
called by 5
module/src/main/java/org/atmosphere/play/AtmosphereUtils.java
write
called by 4
module/src/main/java/org/atmosphere/play/OutStream.java
instance
called by 2
module/src/main/java/org/atmosphere/play/AtmosphereCoordinator.java
isOpen
called by 2
module/src/main/java/org/atmosphere/play/PlayWebSocket.java
_close
called by 2
module/src/main/java/org/atmosphere/play/PlayAsyncIOWriter.java
parseQueryString
called by 2
module/src/main/java/org/atmosphere/play/AtmosphereUtils.java

Shape

Method 45
Class 6
Interface 3

Languages

Java100%

Modules by API surface

module/src/main/java/org/atmosphere/play/PlayAsyncIOWriter.java12 symbols
module/src/main/java/org/atmosphere/play/AtmosphereCoordinator.java12 symbols
module/src/main/java/org/atmosphere/play/AtmosphereWebSocketActor.java8 symbols
module/src/main/java/org/atmosphere/play/PlayWebSocket.java5 symbols
module/src/main/java/org/atmosphere/play/AtmosphereUtils.java5 symbols
module/src/main/java/org/atmosphere/play/AtmosphereController.java5 symbols
module/src/main/java/org/atmosphere/play/OutStream.java3 symbols
module/src/main/java/org/atmosphere/play/PlayInternal.java2 symbols
module/src/main/java/org/atmosphere/play/AtmospherePlaySessionConverter.java2 symbols

For agents

$ claude mcp add atmosphere-play \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page