final WebSocketClientRequest publish = clientFactory.newRequest()
.type("publish").data(jsonBuilder().startObject()
.field("message", "Hello World")
.field("topic", topic).endObject());
WebSocketClient client = clientFactory.newClient(getAddressOfNode("1"),
new WebSocketActionListener.Adapter() {
@Override
public void onConnect(WebSocketClient client) throws IOException {
logger.info("sending subscribe command, channel = {}", client.channel());
subscribe.send(client);