I was able to build a thing that does what I need but with *akka-http* and
crappy Java code for the WebSocket part with Jetty.
- The *Relay* uses an *HttpReceiver* and *WebSocketEmitter**.*
1) When the *WebsocketEmiter* receive a WebSocket connection, it store it
in a *Map*[*TeamId*, *WebSocketConnection*]*.*
2) When the *HttpReceiver* receive a *Command* it create a *Request*(
*Command*)* and *execute a callback method on the relay that start a new
*Handler*(*Request*, *Emitter*)*. *
3) The *Handler* :
3.1) forward the request to *WebSocketEmitter* that send it on the
*WebSocketConnection* and wait for a response* (blocking).
3.2) send the response to the *Request* which success a *Promise*
4) The *HttpReceiver* complete the request by wirting the response.
* The *WebSocketConnection* don't really wait for a reponse, it send the
*Command
*to the remote and set itslef in waiting state (*Object.wait*). When the
*WebSocketConnection* receive a message he parse and store the result and
notify itself to return the result :
Result send(final Command command) {
write(command);
wait();
return this.result;
}
void onWebSocketText(String message) {
this.result = parse(message);
notify();
}
I really would like to replace this part with akka-websocket but
definitively lacks of knowledge on this subject.
--
>>>>>>>>>> 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.