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

com.firefly.codec.websocket.frame.PingFrame Maven / Gradle / Ivy

There is a newer version: 5.0.0-dev6
Show newest version
package com.firefly.codec.websocket.frame;

import com.firefly.codec.websocket.model.OpCode;
import com.firefly.utils.StringUtils;

import java.nio.ByteBuffer;

public class PingFrame extends ControlFrame {
    public PingFrame() {
        super(OpCode.PING);
    }

    public PingFrame setPayload(byte[] bytes) {
        setPayload(ByteBuffer.wrap(bytes));
        return this;
    }

    public PingFrame setPayload(String payload) {
        setPayload(ByteBuffer.wrap(StringUtils.getUtf8Bytes(payload)));
        return this;
    }

    @Override
    public Type getType() {
        return Type.PING;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy