Swiftpack.co - Package - vapor/websocket-kit


Stars: 144

Used By

Total: 0


Fix miscellaneous issues with WebSocket closing -

This patch was authored by @tanner0101 and released by @siemensikkema.

Fixes miscellaneous issues with regards to closing a WebSocket connection (#77)

Fix force try in connect method -

This patch was authored by @jameshartt and released by @tanner0101.

Fix force try in wss:// connect method (#71).

Automatic WebSocket pings -

This patch was authored by @bridger and released by @tanner0101.

Adds a pingInterval property on WebSocket which will trigger automatic pings to the peer to ensure that the connection is still active (#68).

Send correct close code to peer -

This patch was authored by @bridger and released by @tanner0101.

Updates WebSocket close to send correct code to peer according to RFC6455 (#67).

WebSocketKit 2.0.0 -

Release Candidate 1 -

Updates to Swift 5.2 and macOS 10.15. Adds additional CI + README updates.

Release candidates represent the final shift toward focusing on bug fixes and documentation. Breaking changes will only be accepted for critical issues. We expect a final release of this package shortly after Swift 5.2's release date.

Add errorCaught handler to close the WebSocket -

Now when an error is thrown by NIO we receive it and close the WebSocket connection. The error code is available on WebSocket.closeCode by the time the WebSocket.onClose future resolves (#61, fixes #58).

Add channelInactive callback to mark WebSocket as closed. -

The channelInactive callback is triggered when a WebSocket closes without sending a close code. Previously, the WebSocket.onClose future was still fulfilled but WebSocket.isClosed would be false and WebSocket.closeCode would be nil. This would later cause an assertion when WebSocket deinitialized. Now the onClose future is still fulfilled, but while also setting isClosed and closeCode (#60, fixes https://github.com/vapor/vapor/issues/2107).

Fix Atomic Deprecation -

Fixes Atomic deprecation (fixes #53)

wss:// fix -

Fixes a small issue with regards to forwarding bytes on a wss websocket. Also ups NIO version to 2.11.1 because of https://github.com/apple/swift-nio/pull/1280.

Add ping/pong callbacks to WebSocket -

  • Adds onPing and onPong callbacks to WebSocket (#45)

Although WebSocketKit handles ping / pong automatically according to spec, it can be useful to know when these events happen.

ws.onPong { ws in
    print("pong received")

ws.onPing { ws in
    print("ping received")
  • Adds WebSocket.closeCode containing WebSocketErrorCode that is set when the WebSocket closes (#45)

  • HTTPHeaders are now passed through WebSocket.connect calls (#45)

WebSocketKit 2.0.0 Beta 2 -

  • Fixed wss:// default port. (#47, #48)

  • Enabled test discovery on Linux (#50)

WebSocketKit 2.0.0 Beta 1 -

This package has been renamed to WebSocketKit. It now focuses on supplying a WebSocket client modeled after async-http-client. WebSocket server is still supported, but it is expected that you will bring your own NIO ServerBootstrap.

For usage examples, check out the tests folder: https://github.com/vapor/websocket-kit/blob/master/Tests/WebSocketKitTests/NIOWebSocketClientTests.swift

WebSocket 1.1.2 -


  • Fixed a reference cycle in WebSocket.

WebSocket 1.1.1 -


  • WebSocket now buffers incoming messages before callbacks are set. (#31)

WebSocket 1.1.0 -


  • New send(raw:opcode:fin:promise:) method on WebSocket. (#28)
ws.send(raw: "Hello, ", opcode: .text, fin: false)
ws.send(raw: "world", opcode: .continuation, fin: false)
ws.send(raw: "!", opcode: .continuation)
  • WebSocket server now supports parsing continuation frames from the client. (#27)


  • WebSocket client now properly masks pong frame. (#26)

Websocket 1.0.2 -

Fixes masking frame issue in client mode. Thanks @pvels

WebSocket 1.0.1 -


  • Added support for sending / receiving WebSocket close codes (#6, #3).
ws.onCloseCode { closeCode in
ws.close(code: .normalClosure)
  • Max frame size is now configurable for both WebSocket client and server (#7, #4).
  • You can now specify extra headers to add during WebSocket client upgrade (#2).


  • WebSocket.isClosed is now properly set to true when closed (#8, #5).

Milestone: 1.0.1

WebSocket 1.0.0 -

Introducing WebSocket 1.0 🎉 🔌 Non-blocking, event-driven WebSocket client and server built on Swift NIO.

Docs: https://docs.vapor.codes/3.0/websocket/getting-started/

API Docs: https://api.vapor.codes/websocket/latest/WebSocket/

This module has been moved from the old vapor/engine repo to its own package. This will make it easier to version going forward 🙌.

Milestone: 1.0.0