Quantcast
Channel: Akka Libraries - Discussion Forum for Akka technologies
Viewing all articles
Browse latest Browse all 1362

Problem Using getStrictText in handleWebSocketMessages for not stricted message

$
0
0

@maxim_goh wrote:

Hello, I try to use Akka Http server with websocket handling in Java code.
I’v used a handleWebSocketMessages directive as is in the akka doc. site:
https://doc.akka.io/docs/akka-http/current/server-side/websocket-support.html

The problem is when the message is not stricted (long text) I cannot get a text message of the client (I tried to call TextMessage.create(source).getStrictText())

The code of handleTextMessage fuctions is:

public static TextMessage handleTextMessage(TextMessage msg) {
String msgText = “”;
if (msg.asTextMessage().isStrict())
{
msgText = msg.asTextMessage().getStrictText();
} else {
Source<String,NotUsed> source = Source.single("").concat(msg.asTextMessage().getStreamedText());
msgText = TextMessage.create(source).getStrictText();
//handling of msgText …
}
}
How can I extract the text message?
Thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 1362

Trending Articles