I've tried your suggestion, but i'm afraid it doesn't change anything. When the connection succeeds it will log the message and return, otherwise nothing is logged server side, so no other TextMessage or BinaryMessages received.
Luc Op maandag 27 juli 2015 17:03:50 UTC+2 schreef Johannes Rudolph: > > Hi Luc, > > On Mon, Jul 27, 2015 at 4:49 PM, Luc Klaassen <[email protected] > <javascript:>> wrote: > > The connection does not give an error on the client side, but each time > a > > message is sent it should print the message server side and then return > a > > response with the reversed string. None of this is happening most of the > > time. It simply says the websocket connection is open, and none of the > > messages that are sent are received server-side. > > Thanks for confirming. That's not what I observe, for me it seems to work. > > However (also, as hinted on the SO issue) your use of `collect` is a > risk as it won't work in all cases. A message is not guaranteed to be > strict, so you may miss streamed messages (see [1]). Try > > def websocketActorFlow: Flow[Message, Message, Unit] = > Flow[Message].mapConcat{ > case TextMessage.Strict(msg) => > println(msg) > TextMessage.Strict(msg.reverse) :: Nil > > case other: TextMessage => > println(s"Got other text $other") > other.textStream.runWith(Sink.ignore) > Nil > > case other: BinaryMessage => > println(s"Got other binary $other") > other.dataStream.runWith(Sink.ignore) > > Nil > } > > and see if you get streamed messages some times. If you get a > non-strict `TextMessage` you either need to handle it in a streaming > fashion or you need to buffer the complete message and only run your > processing, then, on the aggregated string. The second alternative has > the usual risk of using unbounded memory. > > That said, I guess that we could need some convenience helpers that > would help with aggregating messages allowing you to specify the > maximum number of characters and maximum duration for which the > aggregation should run per message. > > Johannes > > [1] > http://doc.akka.io/docs/akka-stream-and-http-experimental/1.0/scala/http/routing-dsl/websocket-support.html#Model > > -- >>>>>>>>>> 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 http://groups.google.com/group/akka-user. For more options, visit https://groups.google.com/d/optout.
