Skip to content

Conversation

@akbashev
Copy link
Contributor

@akbashev akbashev commented Jul 4, 2024

Motivation

While working with my swift distributed actors showcase one of the points for me was to try openapi. As this is a chat client showcase, took me some time to realise that you can do bidirectional streaming. Think this is quite an important feature and not very discoverable, so to fill this gap—created two simple examples. Things to consider:

  • Basically copied and updated event-streams-_-example
  • For simplicity using just json lines.
  • Tried to be simple overall, e.g. there could be such things as heartbeat messages to keep/close connections, but think this should be done by whoever implements the clients.
  • Switched to AsyncHttpTransport, cause for URLSession you need a hack, see comment.
  • While playing switched to Hummingbird, can switch back to Vapor though.

Modifications

Working examples showing bidirectional streaming both for server and client.

Test Plan

I've tested myself, it's working, don't think examples are covered with tests.

akbashev and others added 3 commits July 4, 2024 11:03
Co-authored-by: Honza Dvorsky <[email protected]>
Co-authored-by: Honza Dvorsky <[email protected]>
@czechboy0
Copy link
Contributor

@swift-server-bot test this please

@czechboy0
Copy link
Contributor

@akbashev Please run ./scripts/run-swift-format.sh --fix and fix up the issues it's complaining about, then I can rerun the CI.

@akbashev
Copy link
Contributor Author

akbashev commented Jul 4, 2024

@akbashev Please run ./scripts/run-swift-format.sh --fix and fix up the issues it's complaining about, then I can rerun the CI.

Ah, while trying to figure out about streams and URLSession, completely forgot about swift-format. Just run and pushed fixes.

@czechboy0
Copy link
Contributor

@swift-server-bot test this please

@czechboy0
Copy link
Contributor

@swift-server-bot test this please

Copy link
Contributor

@czechboy0 czechboy0 left a comment

Choose a reason for hiding this comment

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

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver/none No version bump required.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants