While Akka HTTP is accessible to Java 8 users I decided to go for an 
alternative which I was trying to avoid but at least I know is of high 
performance and it fits right my needs.
When a connection is upgraded to websocket it is passed to an actor, also 
every message sent is forwarded to an Actor, Java 8 code snippet below:

      vertx.createHttpServer().requestHandler(request -> {
        if ("/signal".equals(request.path())) {
          final ServerWebSocket socket = request.upgrade();
          final ActorRef actorRef = context().system().actorOf(
            // Using an internal non-blocking bounded mailbox with capacity 
reserved (similar to LMAX)
            Props.create(new SignalWebsocketCreator(SourceSupervisor.this, 
socket)).withMailbox("bounded-mailbox-1024")
          );
          socket.setWriteQueueMaxSize(1024).
            handler(event -> actorRef.tell(event, noSender())).
            closeHandler(event -> actorRef.tell(PoisonPill.getInstance(), 
noSender()));
          log.info("Websocket connection from '{}' to {} established.", 
socket.remoteAddress(), socket.localAddress());
        } else {
          request.response().setStatusCode(400).end();
        }
      }).listen(config.getInt("http.port"), config.getString("http.host"));


Hope it helps some Java fellows that are stuck on this matter, not ideal if 
you want to strictly stick to Akka like I wanted though it is still a 
quick, simple and efficient solution,

Guido.

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to