Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced to async method for URLSessionWebSocketTask.receive(). #2145

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kitwtnb
Copy link
Contributor

@kitwtnb kitwtnb commented Jul 25, 2024

Using MainActor properties in an unstructured task would cause build errors in Swift 6, so URLSessionWebSocketTask.receive(completionHandler:) was replaced with URLSessionWebSocketTask.receive() async throws.

@Dimillian
Copy link
Owner

This is cool thanks! Will try in a bit and merge!

}
private func receiveMessage() async {
do {
guard let message = try await task?.receive() else { return }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think you should return here as it could break the next receiveMessage loop.

@Dimillian
Copy link
Owner

This is weird, I've been testing it extensively and never received any message.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants