[FIX] Возможность отправки сообщений по Channel

This commit is contained in:
Gravit 2019-11-30 03:47:40 +07:00
parent 8c62cfff11
commit 773981c32f
No known key found for this signature in database
GPG key ID: 061981E1E85D3216

View file

@ -133,6 +133,14 @@ public void sendObject(ChannelHandlerContext ctx, Object obj, Type type) {
ctx.writeAndFlush(new TextWebSocketFrame(gson.toJson(obj, type)), ctx.voidPromise()); ctx.writeAndFlush(new TextWebSocketFrame(gson.toJson(obj, type)), ctx.voidPromise());
} }
public void sendObject(Channel channel, Object obj) {
channel.writeAndFlush(new TextWebSocketFrame(gson.toJson(obj, WebSocketEvent.class)), channel.voidPromise());
}
public void sendObject(Channel channel, Object obj, Type type) {
channel.writeAndFlush(new TextWebSocketFrame(gson.toJson(obj, type)), channel.voidPromise());
}
public void sendObjectAll(Object obj) { public void sendObjectAll(Object obj) {
for (Channel ch : channels) { for (Channel ch : channels) {
ch.writeAndFlush(new TextWebSocketFrame(gson.toJson(obj, WebSocketEvent.class)), ch.voidPromise()); ch.writeAndFlush(new TextWebSocketFrame(gson.toJson(obj, WebSocketEvent.class)), ch.voidPromise());