Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Implement transport compression #56

Merged
merged 4 commits into from
May 18, 2019
Merged

Conversation

omochi
Copy link

@omochi omochi commented May 16, 2019

I implemented transport compression.
I keep code difference small as much as I can.
I split changes to some commits so that it is easy to review.

I explain detail.

- 0206648: Change nio-websocket-client to my fork.
This commit is submitted as this PR https://github.com/vapor/nio-websocket-client/pull/4
It solves problems them.
- WebSocket binary frame support
- Fix bug that WebSocket stream lost sometimes.

  • b0f6909: Set TLSConfiguration if URL has wss: scheme.
  • 8238f94: Pass URL to websocket.
    It fix bug that query string parameters such like compress does not work at all.
  • b0923b4: Implement some CodingKeys to parse message from Discord server.
    - c3ff2ef: Implement Sword.request.
  • 8c1333e: Fix simple bug that use wrong variable.
    - 246f2dd: Implement logic that recreate zlib stream context when socket reconnect.
    This PR add didConnect method in GatewayHandler to do this.

let config = WebSocketClient.Configuration(maxFrameSize: 1 << 31)
var config = WebSocketClient.Configuration(maxFrameSize: 1 << 31)

func _isSSL() -> Bool {
Copy link
Owner

Choose a reason for hiding this comment

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

Discord is always going to routed through wss and port 443 (if /gateway/bot didnt already give us one). You really only need to do:

let config = WebSocketClient.Configuration(
  tlsConfiguration: .forClient(),
  maxFrameSize: 1 << 31
)

Copy link
Author

Choose a reason for hiding this comment

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

OK. I rewrote it at 401a68a.

@Azoy
Copy link
Owner

Azoy commented May 18, 2019

I'd be willing to take b0f6909, 8238f94, b0923b4, and 8c1333e. I'd prefer to stay depending on vapor's repo, I have some changes to request that I have locally that I want to push soon, and I'd really like to fix zlib if you don't mind (I might ditch it in favor of something else maybe). It would be beneficial if your changes got landed on vapor's repo however.

@omochi
Copy link
Author

omochi commented May 18, 2019

Thanks to check.
I rebased PR to pick these 4 commits up and dropped others.

I will open issues about dropped topics to tell that you recognize these problems for other library users.
When your changes to be shared, I close them.

@Azoy Azoy merged commit 0dbceac into Azoy:rewrite May 18, 2019
@omochi omochi deleted the transport-compression branch May 18, 2019 04:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants