Last active
August 9, 2020 16:17
-
-
Save nsadeh/befa2344b3d2bdd038c091cc85910ebf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
implicit val spawnSystem = ActorSystem(SpawnProtocol(), "spawn") | |
def messageRoute = | |
// pattern matching on the URL | |
pathPrefix("message" / Segment) { trainerId => | |
// await on the webflow materialization pending session actor creation by the spawnSystem | |
Await.ready(ChatSessionMap.findOrCreate(trainerId).webflow(), Duration.Inf).value.get match { | |
case Success(value) => handleWebSocketMessages(value) | |
case Failure(exception) => | |
println(exception.getMessage()) | |
failWith(exception) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment