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

com.blade.mvc.websocket.WebSocketContext Maven / Gradle / Ivy

package com.blade.mvc.websocket;

import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.http.websocketx.TextWebSocketFrame;
import lombok.Data;

/**
 * @author biezhi
 * @date 2017/10/30
 */
@Data
public class WebSocketContext {

    private ChannelHandlerContext ctx;
    private WebSocketSession      session;
    private String                reqText;

    public WebSocketContext(ChannelHandlerContext ctx) {
        this.ctx = ctx;
        this.session = new WebSocketSession(ctx.channel());
    }

    public void message(String value) {
        ctx.writeAndFlush(new TextWebSocketFrame(value));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy