Remove simple line parsing, exposing explicit delimiter stage instead
This commit is contained in:
parent
79e24c5976
commit
8702f09f10
7 changed files with 21 additions and 33 deletions
|
|
@ -47,7 +47,8 @@ class StreamTcpDocSpec extends AkkaSpec {
|
|||
println(s"New connection from: ${connection.remoteAddress}")
|
||||
|
||||
val echo = Flow[ByteString]
|
||||
.via(Framing.lines("\n", maximumLineBytes = 256, allowTruncation = false))
|
||||
.via(Framing.delimiter(ByteString("\n"), maximumFrameLength = 256, allowTruncation = true))
|
||||
.map(_.utf8String)
|
||||
.map(_ + "!!!\n")
|
||||
.map(ByteString(_))
|
||||
|
||||
|
|
@ -85,7 +86,8 @@ class StreamTcpDocSpec extends AkkaSpec {
|
|||
|
||||
val welcome = Source.single(ByteString(welcomeMsg))
|
||||
val echo = b.add(Flow[ByteString]
|
||||
.via(Framing.lines("\n", maximumLineBytes = 256, allowTruncation = false))
|
||||
.via(Framing.delimiter(ByteString("\n"), maximumFrameLength = 256, allowTruncation = true))
|
||||
.map(_.utf8String)
|
||||
//#welcome-banner-chat-server
|
||||
.map { command ⇒ serverProbe.ref ! command; command }
|
||||
//#welcome-banner-chat-server
|
||||
|
|
@ -136,7 +138,8 @@ class StreamTcpDocSpec extends AkkaSpec {
|
|||
}
|
||||
|
||||
val repl = Flow[ByteString]
|
||||
.via(Framing.lines("\n", maximumLineBytes = 256, allowTruncation = false))
|
||||
.via(Framing.delimiter(ByteString("\n"), maximumFrameLength = 256, allowTruncation = true))
|
||||
.map(_.utf8String)
|
||||
.map(text => println("Server: " + text))
|
||||
.map(_ => readLine("> "))
|
||||
.transform(() ⇒ replParser)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue