All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.hison.api.caching.WebSocketHandler Maven / Gradle / Ivy

Go to download

API-Link is a novel solution for Spring projects, aimed at streamlining development by eliminating the need for individual controllers. It allows developers to use a single 'cmd' value to invoke service layer methods, simplifying workflow and boosting productivity.

The newest version!
package io.github.hison.api.caching;

import org.springframework.web.socket.WebSocketSession;
import org.springframework.web.socket.handler.AbstractWebSocketHandler;
import org.springframework.web.socket.CloseStatus;

/** 
 * @author Hani son
 * @version 1.0.0
 */
public class WebSocketHandler extends AbstractWebSocketHandler {
    private final CachingWebSocketSessionManager sessionManager;

    public WebSocketHandler(CachingWebSocketSessionManager sessionManager) {
        this.sessionManager = sessionManager;
    }

    @Override
    public void afterConnectionEstablished(WebSocketSession session) {
        sessionManager.addSession(session);
    }

    @Override
    public void afterConnectionClosed(WebSocketSession session, CloseStatus status) {
        sessionManager.removeSession(session);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy