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

Please provide a WebSocket client example #465

Open
gmosx opened this issue Jun 3, 2018 · 4 comments

Comments

@gmosx
Copy link

commented Jun 3, 2018

Expected behavior

It would be great to have an example for a WebSocket client (or even an HTTP client
for that matter)

@MrLotU

This comment has been minimized.

Copy link
Contributor

commented Jan 7, 2019

Would be greatly appreciated 😄

@tigerpixel

This comment has been minimized.

Copy link
Contributor

commented Apr 7, 2019

While investigating this, I noticed that there were also no UDP or HTTP1 client examples. In addition, the readme for other client examples were missing. Those have now been added.

@tigerpixel

This comment has been minimized.

Copy link
Contributor

commented Apr 12, 2019

I have started coding a WebSocket client example.

In order to do so, I have written a 'HTTPClientUpgradeHandler' and 'WebClientSocketUpgrader' pair to match the 'HTTPServerUpgradeHandler' and 'WebSocketUpgrader' which already exist to handle the server upgrade. At the moment, I have mostly done this by copying the original pair and then changing/deleting code as required. So there is a decent amount of duplication. I am at the stage where it generally works for the happy path. It is very rough and ready and without any tests. I can post some code if it is felt that would help to understand my description but I am a while away from any proper PR.

Mostly though, before pressing on too much, I was hoping to get feedback this technique. Specifically, I would like to ask if this seems like a generally correct approach? Or might there be a simpler solution that I may have missed?

Also, should I open a separate issue for the client upgrader? #306 seems as related to a client upgrader as this ticket.

thanks

@Lukasa

This comment has been minimized.

Copy link
Contributor

commented Apr 13, 2019

I don’t think we need a separate issue opened. You may want to check Vapor’s codebase, which I know has a client upgrader you could draw experience from.

tigerpixel pushed a commit to tigerpixel/swift-nio that referenced this issue Jul 12, 2019

Liam Flynn
Add a WebSocket Client example class to match the WebSocket server ex…
…ample.

Motivation:

To provide an example of the usage of the WebSocket client upgrade functionality.
To satisfy issue apple#465

Modifications:

Added a ‘WebSocketClient’ example with a readme and a target in the package file.

Result:

There is now a WebSocket client example to assist with the creation of a WebSocket client.

weissi added a commit that referenced this issue Jul 26, 2019

Add a WebSocket Client example. As Per issue #465 (#1064)
Motivation:

To provide an example of the usage of the WebSocket client upgrade functionality.
To satisfy issue #465

Modifications:

Added a ‘WebSocketClient’ example with a readme and a target in the package file.

Result:

There is now a WebSocket client example to assist with the creation of a WebSocket client.

tigerpixel pushed a commit to tigerpixel/swift-nio that referenced this issue Jul 30, 2019

Liam Flynn
Update the README file to include some recently added examples.
Motivation:

To give visibility to recently added examples.
To satisfy issue apple#465

Modifications:

Added links to examples in readme.
Slightly re-arranged the order so that echo examples are next to each other in the list.

Result:

You can now see the UDP, HTTP and WebSocket client examples from the README file.

Lukasa added a commit that referenced this issue Jul 30, 2019

Update the README file to include some recently added examples. (#1087)
Motivation:

To give visibility to recently added examples.
To satisfy issue #465

Modifications:

Added links to examples in readme.
Slightly re-arranged the order so that echo examples are next to each other in the list.

Result:

You can now see the UDP, HTTP and WebSocket client examples from the README file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.