Last active
August 29, 2015 14:01
-
-
Save yongboy/87b27ab59c9d2c2e8cfa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Sharable | |
public class MqttMessageWebSocketFrameEncoder extends | |
MessageToMessageEncoder<Message> { | |
@Override | |
protected void encode(ChannelHandlerContext ctx, Message msg, | |
List<Object> out) throws Exception { | |
if (msg == null) | |
return; | |
byte[] data = ((Message) msg).toBytes(); | |
out.add(new BinaryWebSocketFrame(Unpooled.wrappedBuffer(data))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment