I have a Vert.X SockJS server running using the following code:
HttpServer httpServer = vertx.createHttpServer();
SockJSServer sockJSServer = vertx.createSockJSServer(httpServer);
JsonObject config = new JsonObject().putString("prefix", "/echo");
sockJSServer.installApp(config, new Handler<SockJSSocket>() {
public void handle(SockJSSocket sock) {
Pump.createPump(sock, sock).start();
}
});
httpServer.listen(8080);
Now I need to send messages from the server to an Android (and vice versa) application and I have no idea how to set that up on the client. The documentation talks about handling that in JavaScript but on the browser.
UPDATE: I believe the following code is a bit in the right direction. I still need to add the host ip address (not sure how).
public void start() {
SockJSSocket client = new SockJSSocketBase(vertx){
@Override
public boolean writeQueueFull(){
// TODO Auto-generated method stub
return false;
}
@Override
public SockJSSocket setWriteQueueMaxSize(int arg0){
// TODO Auto-generated method stub
return null;
}
@Override
public SockJSSocket drainHandler(Handler<Void> arg0){
// TODO Auto-generated method stub
return null;
}
@Override
public SockJSSocket write(Buffer arg0){
// TODO Auto-generated method stub
return null;
}
@Override
public SockJSSocket exceptionHandler(Handler<Throwable> arg0){
// TODO Auto-generated method stub
return null;
}
@Override
public SockJSSocket resume(){
// TODO Auto-generated method stub
return null;
}
@Override
public SockJSSocket pause(){
// TODO Auto-generated method stub
return null;
}
@Override
public SockJSSocket dataHandler(Handler<Buffer> arg0){
// TODO Auto-generated method stub
return null;
}
@Override
public SockJSSocket endHandler(Handler<Void> arg0){
// TODO Auto-generated method stub
return null;
}
};
}
Thanks in advanced!