package com.pwt.netty.message;

import lombok.Data;

import java.io.Serializable;

/**
 * @author linyun
 * @version V1.0
 * @Title: WebSocketMessage
 * @Description: websocket数据对象
 * @date 2022/11/17
 **/
@Data
public class WebSocketMessage implements Serializable {

    /**
     * 数据类型
     */
    private String dataType;

    /**
     * 数据对象
     */
    private Object payload;

    public WebSocketMessage()
    {
    }

    public WebSocketMessage(String dataType, Object data)
    {
        this.dataType = dataType;
        this.payload = data;
    }

    public static WebSocketMessage build(String dataType, Object data)
    {
        return new WebSocketMessage(dataType, data);
    }
}
