WebSocketActor GlobalActor in CaseStudies #1536
Unanswered
JackYoustra
asked this question in
Q&A
Replies: 1 comment 1 reply
-
This example is maybe a little more complex than is really necessary. The web socket client supports servicing any number of web socket connections, hence the We don't actually use that power in the case study since there is only one single connection. We could maybe simplify. Stephen and I will discuss. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm looking for a way for a dependency to synchronize its entrypoints, and found the useful
WebSocketClient
code. I see thatWebSocketActor
conforms toGlobalActor
but I can't figure out why. Can anyone help?EDIT:
A few other questions as I look at the code more:
WebSocketActor
? It seems like only one will ever be created (it's wrapped in the synchronized constructor forliveValue
).open
andreceive:
seem strange: you have a signature of, in receive's case,@Sendable (Any.Type) async throws -> AsyncStream<TaskResult<Message>>
. Is the actor barrier the reason why you can't have a synchronous method returning anAsyncStream
? Any reason why there can't be an adapter written for this? Am I completely off-base?Beta Was this translation helpful? Give feedback.
All reactions