public void start() {
int port = 9191;
HttpServer server = vertx.createHttpServer();
SocketIOServer io = new DefaultSocketIOServer(vertx, server);
final Namespace chat = io.of("/chat");
chat.onConnection(new Handler<SocketIOSocket>() {
public void handle(SocketIOSocket socket) {
socket.on("namespace emit", new Handler<JsonObject>() {
public void handle(JsonObject event) {
chat.emit("msg", new JsonObject().putString("everyone", "in").putString("/chat", "will get"));
}
});
}
});
final Namespace news = io.of("/news");
news.onConnection(new Handler<SocketIOSocket>() {
public void handle(SocketIOSocket socket) {
socket.emit("item", new JsonObject().putString("news", "item"));
}
});