Skip to content

Commit

Permalink
2.0.0 gm (#69)
Browse files Browse the repository at this point in the history
* gm

* add license

* docs

* unmask ping, fixes #49

* fix typo
  • Loading branch information
tanner0101 authored Mar 30, 2020
1 parent aac4624 commit f46778e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2020 Qutheory, LLC

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 6 additions & 1 deletion Sources/WebSocketKit/WebSocket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,13 @@ public final class WebSocket {
}
case .ping:
if frame.fin {
var frameData = frame.data
let maskingKey = frame.maskKey
if let maskingKey = maskingKey {
frameData.webSocketUnmask(maskingKey)
}
self.send(
raw: frame.data.readableBytesView,
raw: frameData.readableBytesView,
opcode: .pong,
fin: true,
promise: nil
Expand Down
1 change: 0 additions & 1 deletion Sources/WebSocketKit/WebSocketHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ private final class WebSocketHandler: ChannelInboundHandler {
self.webSocket = webSocket
}

/// See `ChannelInboundHandler`.
func channelRead(context: ChannelHandlerContext, data: NIOAny) {
let frame = self.unwrapInboundIn(data)
self.webSocket.handle(incoming: frame)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import NIOHTTP1
import NIOWebSocket
@testable import WebSocketKit

final class NIOWebSocketClientTests: XCTestCase {
final class WebSocketKitTests: XCTestCase {
func testWebSocketEcho() throws {
let promise = elg.next().makePromise(of: String.self)
WebSocket.connect(to: "ws://echo.websocket.org", on: elg) { ws in
Expand Down

0 comments on commit f46778e

Please sign in to comment.