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

org.voovan.http.extend.engineio.EIOHandler Maven / Gradle / Ivy

package org.voovan.http.extend.engineio;

import org.voovan.http.websocket.WebSocketSession;
import org.voovan.http.websocket.exception.WebSocketFilterException;
import org.voovan.network.exception.SendMessageException;

/**
 * Engine IO 业务句柄
 *
 * @author: helyho
 * Voovan Framework.
 * WebSite: https://github.com/helyho/Voovan
 * Licence: Apache v2 License
 */
public abstract class EIOHandler {

    private WebSocketSession webSocketSession;

    public void setWebSocketSession(WebSocketSession webSocketSession) {
         this.webSocketSession = webSocketSession;
    }

    public EIOSession getEIOSession() {
        EIOSession eioSession = (EIOSession) webSocketSession.getAttribute("EIO_SESSION");
        if(eioSession == null) {
            eioSession = new EIOSession(this.webSocketSession, this);
            webSocketSession.setAttribute("EIOSession", eioSession);
        }
        return eioSession;
    }

    public void send(String msg) throws SendMessageException, WebSocketFilterException {
        this.getEIOSession().send(msg);
    }

    public abstract String execute(String msg);
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy