com.iteaj.iot.client.websocket.impl.DefaultWebSocketClientMessage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of iot-client Show documentation
Show all versions of iot-client Show documentation
基于netty的tcp, http, udp等协议的客户端
The newest version!
package com.iteaj.iot.client.websocket.impl;
import com.iteaj.iot.client.websocket.WebSocketClientMessage;
import com.iteaj.iot.message.DefaultMessageHead;
import com.iteaj.iot.websocket.WebSocketCloseHead;
import com.iteaj.iot.websocket.WebSocketFrameType;
import com.iteaj.iot.websocket.WebSocketProtocolType;
public class DefaultWebSocketClientMessage extends WebSocketClientMessage {
private WebSocketFrameType frameType;
public DefaultWebSocketClientMessage(byte[] message) {
super(message);
}
public DefaultWebSocketClientMessage(MessageHead head) {
super(head);
}
public DefaultWebSocketClientMessage(MessageHead head, MessageBody body) {
super(head, body);
}
@Override
protected MessageHead doBuild(byte[] message) {
if(frameType() == WebSocketFrameType.Close) {
return new WebSocketCloseHead(getChannelId());
}
return new DefaultMessageHead(getChannelId(), null, WebSocketProtocolType.Default_Client);
}
@Override
public WebSocketFrameType frameType() {
return this.frameType;
}
@Override
public DefaultWebSocketClientMessage setFrameType(WebSocketFrameType frameType) {
this.frameType = frameType;
return this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy