Skip to content

Commit

Permalink
Fix WebSocket implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostdogpr committed Mar 16, 2020
1 parent 6e69abb commit 37951b2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion akka-http/src/main/scala/caliban/AkkaHttpAdapter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ object AkkaHttpAdapter extends FailFastCirceSupport {
case ObjectValue((fieldName, StreamValue(stream)) :: Nil) =>
stream.foreach { item =>
sendMessage(queue, id, ObjectValue(List(fieldName -> item)), result.errors)
}.fork.flatMap(fiber => subscriptions.update(_.updated(id, fiber)))
}.forkDaemon.flatMap(fiber => subscriptions.update(_.updated(id, fiber)))
case other =>
sendMessage(queue, id, other, result.errors) *> IO.fromFuture(_ =>
queue.offer(TextMessage(s"""{"type":"complete","id":"$id"}"""))
Expand Down
2 changes: 1 addition & 1 deletion http4s/src/main/scala/caliban/Http4sAdapter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ object Http4sAdapter {
case ObjectValue((fieldName, StreamValue(stream)) :: Nil) =>
stream.foreach { item =>
sendMessage(sendQueue, id, ObjectValue(List(fieldName -> item)), result.errors)
}.fork.flatMap(fiber => subscriptions.update(_.updated(id, fiber)))
}.forkDaemon.flatMap(fiber => subscriptions.update(_.updated(id, fiber)))
case other =>
sendMessage(sendQueue, id, other, result.errors) *> sendQueue.enqueue1(
WebSocketFrame.Text(s"""{"type":"complete","id":"$id"}""")
Expand Down

0 comments on commit 37951b2

Please sign in to comment.