Thank you for the quick reply! This is indeed an interesting example (albeit a bit complex for my need).
For the simplest case all I would want to do is create a websocket server which can at-will push json messages to a (single) connected client (which would then display on its end, so the client side will accept json and display a graph from the json). The client side is all javascript and written already (borrowed from previous work, it can connect to a websocket and send and receive messages along it). I wanted to replace my current jetty implementation with akka websockets since so much of the rest of my app uses reactive akka (plus to learn how to do it for future projects etc). So basically I just want to be able to issue a command to the client from the server. I will look more at the example you shared and try and unpack it (scala is not my strongest language ;D) Andy On Friday, April 21, 2017 at 12:21:19 PM UTC-5, Konrad Malawski wrote: > Hi Andy, > further details on how (where to which client) you want to push would be > helpful for my understanding (and future development). > > We have developed an example app recently that does such a thing, it > registers "drones" in an actor that keeps track of them by ID, and allows > the server at-will to push commands to the drones into the websocket > connection such drone has opened. > > It does a bit more so (handles resumption and clustering) it's more > complex, but you could have a look at it for now: > > https://github.com/henrikengstrom/sa-2017-akka/blob/master/src/main/scala/org/h3nk3/saconf/backend/DroneConnectionHub.scala > > It is in Scala but the code would be pretty much the same in Java. > I think this may point you in the direction you might want to take this. > > Hope this helps > > -- > Konrad `ktoso` Malawski > Akka <http://akka.io> @ Lightbend <http://lightbend.com> > > On 22 April 2017 at 02:15:32, Andrew Schenck ([email protected] > <javascript:>) wrote: > > Hello all, > > I have scoured the questions raised here that are similar to my needs but > so far have not been successful at finding a solution. > > I need (want) to be able to create an akka websocket server in which I can > send messages from the server to the clients connected (for example, send > the outputs from a flink analytic along the websocket to an end user GUI). > I was able to implement the request-response example, but so far have had > little success in a 'server push' model. > > Using something like jetty it is as easy as ws.broadcast, but I understand > akka needs to use backpressure etc, soI guess what I am stumbling with is > how to create a proper flow in a 'server-push' model, in *java*. > > If there are examples I can look at (haven't found any) or some literature > I can read or any suggestions as to how to create this 'server-push' > websocket model it would be greatly appreciated. > > Thanks for the help, > > Andy > -- > >>>>>>>>>> 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] <javascript:>. > To post to this group, send email to [email protected] > <javascript:>. > Visit this group at https://groups.google.com/group/akka-user. > For more options, visit https://groups.google.com/d/optout. > > -- >>>>>>>>>> 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.
