jeudi 31 mars 2016

What performs websocketHandler? [duplicate]

This question already has an answer here:

Working with vert.x core 3.2.1 I found such code, which creates http-server with websocket:

vertx.createHttpServer().websocketHandler(ws -> ws.handler(ws::writeBinaryMessage)).requestHandler(req -> {
      if (req.uri().equals("/")) req.response().sendFile("ws.html");
    }).listen(8080);

I understood, that this code launched http-server which used 8080-port. Also I see in it 2 handlers: webSocket and requestHandler. Because of "lambdas" I don't quite understand syntax of webSocket handler. Could you explain wht's going on there, or write this code without using lambda-expression(these expression confused me:( )




Aucun commentaire:

Enregistrer un commentaire