Commit Graph

6 Commits

Author SHA1 Message Date
David Nadoba 16b5b2b793
Replace `NIOSendable` with `Sendable` (#2291) 2022-10-13 15:56:27 +01:00
David Nadoba fbe7ef484a
Adopt `Sendable` for Types in `NIOWebSocket` (#2217) 2022-07-05 11:50:55 +01:00
Johannes Weiss 0ac7e2266b
remove extension public/internal modifiers (#822)
Motivation:

public/internal modifiers for `extension`s are confusing as a
`func foo` is public if within a `public extension`.

Modifications:

remove all `internal` (redundant) and `public` (dangerous) modifiers for
`extensions`.

Result:

- code easier to read
- code much easier to review in a small diff
2019-02-14 13:25:30 +00:00
Cory Benfield f3f6e09ba2
Make WebSocketOpcode a struct. (#694)
Motivation:

WebSocketOpcode was made an enumeration to make it possible to cleanly
switch over the values in switch statements. However, this unfortunately
made it possible to construct contradictory values of WebSocketOpcode,
such as .unknownNonControl(0x1) (which should be spelled .text), or
.unknownControl(0xFF) (which is simply invalid).

This patch removes the ability to construct invalid values of
WebSocketOpcode by turning it into a struct and using static lets for known
values. While we're here it cleans some other stuff up.

Modifications:

- Made WebSocketOpcode a struct
- Added several static lets for easy access and to reduce code churn
- Used synthesised Equatable conformance
- Added synthesised Hashable conformance
- Added CustomStringConvertible conformance to better represent known values
- Added CaseIterable conformance to provide entire range of valid values.

Result:

WebSocketOpcode will be a better-behaved type with more guarantees and
fewer places to trap and explode.

Resolves #617.
2018-12-11 11:56:10 +00:00
Johannes Weiss 26bee21674 fix Swift 5 warnings (mostly redundant modifiers (#642)
Motivation:

Swift 5 complains on redundant modifiers. For example declaring a
`public func` inside of a `public extension` is now a warning. I don't
agree with this but I dislike warnings even more, so...

Modifications:

remove all redundant modifiers that the compiler now warns about such as

    swift-nio/Sources/NIOPriorityQueue/PriorityQueue.swift:90:5: warning: 'public' modifier is redundant for property declared in a public extension

Result:

no warnings in Swift 5
2018-11-01 09:50:55 +00:00
Cory Benfield b542775605 Add initial websocket codec. (#109)
Motivation:

Websockets is a major protocol in use on the web today, and is
particularly valuable in applications that use asynchronous I/O
as it allows servers to keep connections open for long periods of
time for fully-duplex communication.

Users of NIO should be able to build websocket clients and servers
without too much difficulty.

Modifications:

Provided a WebsocketFrameEncoder and Decoder that can serialize and
deserialize Websocket frames.

Result:

Easier use of websockets.
2018-03-13 17:24:54 +01:00