use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.
the class Messages method broadcastMessage.
static ChannelBroadcastMessage broadcastMessage(String channel, Object event) throws Exception {
final ChannelBroadcastMessage message = new ChannelBroadcastMessage();
message.setBody(toJson(event));
message.setChannel(channel);
return message;
}
use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.
the class BufferOutputFixedRateSender method sendMessage.
private synchronized void sendMessage() {
final ChannelBroadcastMessage message = new ChannelBroadcastMessage();
message.setChannel(channel);
String text = getText();
if (text.isEmpty()) {
return;
}
message.setBody(text);
sendMessageToWS(message);
lines.clear();
}
use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.
the class MavenWebSocketCommunication method send.
@Override
public void send(JsonObject dto, MessageType type) {
try {
ChannelBroadcastMessage message = new ChannelBroadcastMessage();
message.setChannel(MavenAttributes.MAVEN_CHANEL_NAME);
dto.addProperty("$type", type.getType());
message.setBody(dto.toString());
WSConnectionContext.sendMessage(message);
} catch (EncodeException | IOException e) {
LOG.error("Can't send maven message:", e);
}
}
use of org.everrest.websockets.message.ChannelBroadcastMessage in project che by eclipse.
the class WebsocketLineConsumer method writeLine.
@Override
public void writeLine(String line) throws IOException {
final ChannelBroadcastMessage bm = new ChannelBroadcastMessage();
bm.setChannel(channel);
bm.setBody(line);
try {
WSConnectionContext.sendMessage(bm);
} catch (Exception e) {
LOG.error("A problem occurred while sending websocket message", e);
}
}
Aggregations