Compare commits

...

80 Commits

Author SHA1 Message Date
Austin Cherry c6bfd1af48 chore: update release tooling 2024-03-07 12:57:12 -06:00
Austin Cherry 82d8a0119e fix: update build setting to recommended 2024-03-07 12:10:16 -06:00
Dylan 11c401f408 fix: crash as NWEndpoint requires a min target of 12.0 (#998) 2024-03-07 12:05:33 -06:00
Jonathan Ellis b32c9ab481 Add privacy manifest (#1008) 2024-03-07 12:03:19 -06:00
Rüdiger Busche b12442f29c chore: Update install instructions (#984)
Remove Accio instructions, since the project is deprecated. Remove Rouge instructions,
since the repo was not updated since 2014. Move SwiftPM instructions up, since it should be the
default for new projects.
2024-02-20 12:47:38 -06:00
dependabot[bot] d3a0b10732 Bump activesupport from 7.0.7 to 7.0.7.2 (#976)
Bumps [activesupport](https://github.com/rails/rails) from 7.0.7 to 7.0.7.2.
- [Release notes](https://github.com/rails/rails/releases)
- [Changelog](https://github.com/rails/rails/blob/v7.0.7.2/activesupport/CHANGELOG.md)
- [Commits](https://github.com/rails/rails/compare/v7.0.7...v7.0.7.2)

---
updated-dependencies:
- dependency-name: activesupport
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-29 12:08:38 -05:00
Austin Cherry 7723d1ec4f Update README.md 2023-08-22 16:32:08 -05:00
Austin Cherry ac6c0fc9da fix: update README 2023-08-19 16:19:25 -05:00
Mikhail Akopov ca9b1225b7 Update SwiftPM section in Readme (#824) 2023-08-19 16:12:23 -05:00
yohei yoshimuta 86998dd144 Fix connection race when using WSEngine (#930) 2023-08-19 16:11:05 -05:00
Zac West d67812c561 Fix compression when headers don't include window bits (#937) 2023-08-19 16:09:52 -05:00
paul-verkada d2a9549ea4 Fix a leak with the TCPTransport (#923)
Co-authored-by: Andreas Binnewies <andreas.binnewies@verkada.com>
2023-08-19 16:09:19 -05:00
Austin Cherry 7b1e5bb60d fix: update secret 2023-08-19 15:30:29 -05:00
Austin Cherry 4c7b8817a1 fix: release workflow 2023-08-19 15:24:17 -05:00
Austin Cherry f8ac424b8e chore: update bundler 2023-08-19 13:16:38 -05:00
Austin Cherry dcfffe1114 chore: change ruby version 2023-08-19 13:13:57 -05:00
Austin Cherry 76fa39ec30 chore: add ruby version 2023-08-19 13:09:12 -05:00
Austin Cherry ea9a6ff27e feat: cleanup, update for latest xcode/swift, add release workflow 2023-08-19 13:03:25 -05:00
Muhammad Adil 66a441a917 rfc6455 link fixed (#952) 2023-08-16 17:29:37 -05:00
Mustapha Qadri 04acf17f4c Added support for connection error (#912) 2023-08-16 17:25:49 -05:00
dependabot[bot] 826008daab Bump cocoapods-downloader from 1.3.0 to 1.6.3 (#948)
Bumps [cocoapods-downloader](https://github.com/CocoaPods/cocoapods-downloader) from 1.3.0 to 1.6.3.
- [Release notes](https://github.com/CocoaPods/cocoapods-downloader/releases)
- [Changelog](https://github.com/CocoaPods/cocoapods-downloader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/CocoaPods/cocoapods-downloader/compare/1.3.0...1.6.3)

---
updated-dependencies:
- dependency-name: cocoapods-downloader
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 17:24:08 -05:00
newloran2 cdb61a3624 Fix for start websocket with cookies in initial request (#942) 2023-08-16 17:22:28 -05:00
Jenea Vranceanu f900d67759 fix: added peerClosed case for WebSocketEvent enum (#946) 2023-08-16 17:21:37 -05:00
Hugin cb131f8ea3 Update README.md (#950)
Modify the version reference to prevent user copy errors
2023-08-16 17:20:26 -05:00
dependabot[bot] 3c5a484049 Bump tzinfo from 1.2.6 to 1.2.10 (#955)
Bumps [tzinfo](https://github.com/tzinfo/tzinfo) from 1.2.6 to 1.2.10.
- [Release notes](https://github.com/tzinfo/tzinfo/releases)
- [Changelog](https://github.com/tzinfo/tzinfo/blob/master/CHANGES.md)
- [Commits](https://github.com/tzinfo/tzinfo/compare/v1.2.6...v1.2.10)

---
updated-dependencies:
- dependency-name: tzinfo
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 17:19:45 -05:00
dependabot[bot] 5ab0d5a541 Bump addressable from 2.7.0 to 2.8.1 (#963)
Bumps [addressable](https://github.com/sporkmonger/addressable) from 2.7.0 to 2.8.1.
- [Release notes](https://github.com/sporkmonger/addressable/releases)
- [Changelog](https://github.com/sporkmonger/addressable/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sporkmonger/addressable/compare/addressable-2.7.0...addressable-2.8.1)

---
updated-dependencies:
- dependency-name: addressable
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-08-16 17:19:37 -05:00
Ste Prescott 060600f343 Conditionally include 'swift-nio-zlib-support' dependency to avoid warning on macOS (#964)
Co-authored-by: Mykola Varahash <varagash.kolya@gmail.com>
2023-08-16 17:19:18 -05:00
NachoSoto f354881550 Added support for xrOS (#973) 2023-08-16 17:18:19 -05:00
Kristaps Grinbergs c68359159d Merge pull request #894 from Emadgnia/Remove-warnings-on-Xcode-12.5 2021-09-30 22:28:57 +03:00
Emad Ghorbaninia 2c476c7582 Replace all the class with AnyObject due to the deprication. 2021-06-08 10:52:05 +02:00
Dalton 6f18c4938a Merge pull request #812 from JonathanDowning/feature/WebSocketDelegate-change
Allow WebSocketDelegate 'didReceive' method's 'client' parameter to work with `WebSocketClient` mock objects
2021-05-31 14:58:13 -05:00
Dalton 1435d726ae Merge pull request #823 from mininny/feature/mininny/fix-control-frame
Add .pong to be counted as control frame.
2021-05-31 14:01:55 -05:00
Dalton 95eab636fb Merge pull request #845 from XueshiQiao/master
Remove three unused properties
2021-05-31 13:58:22 -05:00
Dalton f567b33704 Merge pull request #839 from moogle19/fix_native_engine_loop
Fix native engine loop
2021-05-31 13:56:22 -05:00
Dalton 62626d875a Merge pull request #863 from hishnash/addHeadersToError
Add Headers to `notAnUpgrade` error.
2021-05-31 13:53:10 -05:00
Dalton 7e7d8a42ef Merge pull request #830 from mininny/feature/mininny/add-templates
Add Issue templates and PR templates.
2021-05-31 13:50:42 -05:00
Eric Rowe a0ba26b7de Explicitly set domain to the passed value (#890) 2021-05-28 20:08:53 -05:00
Jonas Schmid b7f15e63c3 Fixed documentation on compression (#883) 2021-05-28 20:08:37 -05:00
Matthaus Woolard cebca639ee Add Headers to notAnUpgrade error. 2021-01-26 09:24:30 +13:00
Joey e73800e668 Remove three unused properties 2020-10-21 17:40:28 +08:00
Minhyuk Kim 4ae4531e7a Add Issue templates and PR templates. 2020-09-12 22:25:43 +09:00
Minhyuk Kim a55720bd9a Add .pong to be counted as control frame. 2020-08-22 23:43:24 +09:00
Jonathan Downing e95db8ff29 Tweak WebSocketDelegate method signature 2020-08-07 12:57:25 -07:00
moogle 9447264238 Merge branch 'master' of https://github.com/daltoniam/Starscream into fix_native_engine_loop 2020-08-03 15:32:49 +02:00
daltoniam df8d82047f 4.0.4 release 2020-08-01 15:04:10 -05:00
Dalton 85c8412646 Merge pull request #807 from varahash/conditional-zlib-dependency
Conditionally include 'swift-nio-zlib-support' dependency to avoid warning on macOS
2020-07-18 19:48:29 -05:00
Dalton 4820831260 Merge pull request #799 from amayers/xcode12
Fix compile error on Xcode 12
2020-07-18 19:47:50 -05:00
Dalton 024a27711e Merge pull request #808 from dvshelley/deployTarget9
move deployment target to iOS 9 to fix compile for archive with Xcode 12
2020-07-18 19:47:10 -05:00
Daniel Shelley 5987db1605 move deployment target to iOS 9 to fix compile for archive with Xcode 12 2020-07-16 16:50:35 -06:00
Mykola Varahash fe5769f2ae Conditionally include 'swift-nio-zlib-support' dependency to avoid warning on macOS 2020-07-13 01:35:26 +03:00
Andrew Mayers 263b9419bb Fix compile error on Xcode 12
Now you can build on both Xcode 11.5 & 12.0 b1.

On 12, the unit tests would fail to compile because it wasn't finding the `Starscream` framework. So I added `Starscream` as a dependency of the test target.

In `FoundationHTTPServerHandler` the `method` is of type `CFString`, while `getVerb` is `NSString`. Looks like Xcode 12 doesn't like equality comparison between those types without a cast as `NSString`.
2020-06-22 17:23:47 -04:00
Dalton 5fbeab4c12 Merge pull request #777 from jaltreuter/crash_after_disconnect
In FoundationTransport deinit, remove self as a delegate to InputStream and OutputStream to prevent EXC_BAD_ACCESS
2020-06-20 19:20:04 -05:00
Dalton 07bccd9c16 Merge pull request #790 from sdidla/fix_readLoop
Improve conditions for calling readLoop() and prevent infinite looping
2020-06-20 19:18:12 -05:00
Dalton 51b6c789bd Merge pull request #788 from SemyonBaryshev/master
Fix error when trying to convert text message partial payload to UTF-8
2020-06-20 19:15:56 -05:00
Dalton 0c7e7abfd7 Merge pull request #764 from ameyjain/fix/data-extension-swift-version-check
Fix the deadlock issue on iOS 11
2020-06-20 19:13:26 -05:00
Dalton d2f22783b6 Merge pull request #768 from michalsrutek/patch-1
Update README.md
2020-06-20 19:12:03 -05:00
Dalton e6236acc00 Merge pull request #797 from amayers/swift52
Switch SPM to use Swift 5.2
2020-06-20 19:11:18 -05:00
Dalton d003b62b54 Merge pull request #766 from urbanairship/fixUnsafeMutablePointerDeprecation
Fix deprecation warning in WSCompression
2020-06-20 19:07:41 -05:00
Andrew Mayers 70d9e6ec5c Switch SPM to use Swift 5.2 2020-06-17 09:52:36 -04:00
Shammi Didla c0e7d40284 improve conditions for calling readLoop() 2020-06-06 15:27:27 +02:00
Semyon Baryshev 06945ada8b Fix error when trying to convert text message partial payload to UTF-8 2020-06-05 18:39:16 +03:00
moogle fedd77ba8e Stop reading when error is encountered 2020-05-14 15:56:57 +02:00
Jamie Altreuter 7e5a96341c In FoundationTransport deinit, remove self as a delegate to InputStream and OutputStream to prevent EXC_BAD_ACCESS 2020-05-12 18:14:25 -07:00
Michal Šrůtek ce4fcdc967 Update README.md
Update Autobahn link
2020-04-26 10:00:02 +02:00
Nick Ratelle da1d9c69a7 Fix deprecation warning in WSCompression
Apple recommends using the withUnsafeMutableBytes method on the buffer
to bind an unsafe pointer.
2020-04-21 17:54:17 -04:00
Amey Jain b6630118fe Fix the deadlock issue on iOS 11 2020-04-16 11:47:42 -04:00
daltoniam cfc7b7b8dc version bump 2020-04-08 19:59:30 -05:00
daltoniam 311b6dd9c7 fixes #760 2020-04-08 19:58:07 -05:00
daltoniam 339ca39461 improved native engine and a few bug fixes 2020-04-06 14:29:55 -05:00
Dalton 4e8973e3fc Merge pull request #697 from mikaryyn/feature/v4-refactor
Fix for a buffer overflow when close code has not been received from the socket
2020-04-06 14:16:00 -05:00
daltoniam 990a4c858e enabled native engine. Updated Changelog and README 2020-04-04 14:28:42 -05:00
Dalton 3b4c81547a Merge pull request #755 from dylanmaryk/patch-1
Fix "viabilityChanged" typos
2020-04-04 13:57:40 -05:00
Dalton 9e8fcba42e Merge pull request #749 from YellEngineering/feature/fix-foundation-transport-tls
Enable SSL in FoundationTransport for secure hosts
2020-04-04 13:57:16 -05:00
Dylan Maryk d84552f944 Fix typo 2020-03-27 17:54:35 +01:00
Dylan Maryk c3ac0a9df7 Fix typo 2020-03-27 17:50:56 +01:00
Nick Dowell 97538bc11d Enable SSL in FoundationTransport for secure hosts
This fixes connection to secure hosts such as
wss://echo.websocket.org
2020-03-11 16:03:14 +00:00
Patrick Maltagliati 4e8dca654d Use the host for evaluating trust, not the entire URL (#721)
* Use the host for evaluating trust, not the entire URL

* Get host from URLParts
2020-01-13 14:46:07 -06:00
Kristaps Grinbergs 547cb80ef6 Update Travis CI build (#723)
Update Travis CI build
2020-01-06 11:03:23 +02:00
Kristaps Grinbergs 12946fc610 Update Travis CI build 2020-01-06 10:43:29 +02:00
Mika Ryynänen 281a49edd8 Fix for a buffer overflow when close code has not been received from the socket. 2019-09-24 13:13:36 +03:00
51 changed files with 968 additions and 486 deletions
+25
View File
@@ -0,0 +1,25 @@
---
name: Bug report
about: Create a report about a bug
title: ''
labels: bug
assignees: ''
---
### Describe the bug
> A clear and concise description of what the bug is.
### Steps to Reproduce
> Detailed steps to reproduce the problematic behavior:
### Expected behavior
> A clear and concise description of what you expected to happen.
### Environment:
- OS/Version: [e.g. iOS/13.3]
- Starscream Version [e.g. 4.0.4]
- Xcode version [e.g. 11.5]
### Additional context
> Add any other context about the problem here.
+1
View File
@@ -0,0 +1 @@
blank_issues_enabled: false
+23
View File
@@ -0,0 +1,23 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: feature_request
assignees: ''
---
### What do you want to happen?
> Please replace this with the general overview of the feature that you'd like to have.
### What happens now?
> Please replace this with of what is happening currently.
### Demo Code
> Any demo code that may used to implement/use the desired feature.
### Describe alternatives you've considered
> A clear and concise description of any alternative solutions or features you've considered.
### Additional context
> Add any other context or screenshots about the feature request here.
@@ -0,0 +1,16 @@
---
name: General Question
about: 'Ask any question about the framework. '
title: ''
labels: question
assignees: ''
---
### Question
> A description of what you want to know.
### Environment:
- OS/Version: [e.g. iOS/13.3]
- Starscream Version [e.g. 4.0.4]
- Xcode version [e.g. 11.5]
+8
View File
@@ -0,0 +1,8 @@
### Issue Link 🔗
> Please attach the link to an issue if it exists.
### Goals ⚽
> What you hope to address within this PR.
### Implementation Details 🚧
> Additional details about the PR.
+24
View File
@@ -0,0 +1,24 @@
name: Release
on:
push:
tags:
- "*.*.*"
jobs:
release:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Set Latest Tag
id: vars
run: echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- run: bundle exec fastlane test
- run: bundle exec fastlane release
env:
GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
TAG: ${{ steps.vars.outputs.tag }}
+1
View File
@@ -0,0 +1 @@
3.2.2
-7
View File
@@ -1,7 +0,0 @@
osx_image: xcode11
language: objective-c
before_install:
- gem install cocoapods --pre
- gem cleanup
script:
- ./build.sh
+38
View File
@@ -2,6 +2,44 @@
All notable changes to this project will be documented in this file.
`Starscream` adheres to [Semantic Versioning](http://semver.org/).
### [4.0.4](https://github.com/daltoniam/Starscream/tree/4.0.4)
Bug fixes for 4.0.3.
[#808](https://github.com/daltoniam/Starscream/pull/808)
[#807](https://github.com/daltoniam/Starscream/pull/807)
[#799](https://github.com/daltoniam/Starscream/pull/799)
[#797](https://github.com/daltoniam/Starscream/pull/797)
[#790](https://github.com/daltoniam/Starscream/pull/790)
[#788](https://github.com/daltoniam/Starscream/pull/788)
[#777](https://github.com/daltoniam/Starscream/pull/777)
[#768](https://github.com/daltoniam/Starscream/pull/768)
[#766](https://github.com/daltoniam/Starscream/pull/766)
[#764](https://github.com/daltoniam/Starscream/pull/764)
### [4.0.3](https://github.com/daltoniam/Starscream/tree/4.0.3)
Bug fixes for 4.0.2.
[#760](https://github.com/daltoniam/Starscream/issues/760)
### [4.0.2](https://github.com/daltoniam/Starscream/tree/4.0.2)
Bug fixes for 4.0.1. Fixed native engine is connected/disconnected. Native engine isn't the default since the API lacks features.
[#697](https://github.com/daltoniam/Starscream/pull/697)
### [4.0.1](https://github.com/daltoniam/Starscream/tree/4.0.1)
Bug fixes for 4.0.0. Enabled Native engine now that the API is out of beta and works properly.
[#749](https://github.com/daltoniam/Starscream/pull/749)
[#755](https://github.com/daltoniam/Starscream/pull/755)
### [4.0.0](https://github.com/daltoniam/Starscream/tree/4.0.0)
Major API refactor.
### [3.1.1](https://github.com/daltoniam/Starscream/tree/3.1.1)
Small version number fix for 3.1.0: [#703](https://github.com/daltoniam/Starscream/issues/703)
+194 -121
View File
@@ -1,217 +1,290 @@
GEM
remote: https://rubygems.org/
specs:
CFPropertyList (3.0.2)
activesupport (4.2.11.1)
i18n (~> 0.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
algoliasearch (1.27.1)
CFPropertyList (3.0.7)
base64
nkf
rexml
activesupport (6.1.7.7)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
algoliasearch (1.27.5)
httpclient (~> 2.8, >= 2.8.3)
json (>= 1.5.1)
artifactory (3.0.17)
atomos (0.1.3)
babosa (1.0.3)
claide (1.0.3)
cocoapods (1.8.4)
activesupport (>= 4.0.2, < 5)
aws-eventstream (1.3.0)
aws-partitions (1.895.0)
aws-sdk-core (3.191.3)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.77.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.143.0)
aws-sdk-core (~> 3, >= 3.191.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
claide (1.1.0)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.8.4)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 1.2.2, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
cocoapods-search (>= 1.0.0, < 2.0)
cocoapods-stats (>= 1.0.0, < 2.0)
cocoapods-trunk (>= 1.4.0, < 2.0)
cocoapods-trunk (>= 1.6.0, < 2.0)
cocoapods-try (>= 1.1.0, < 2.0)
colored2 (~> 3.1)
escape (~> 0.0.4)
fourflusher (>= 2.3.0, < 3.0)
gh_inspector (~> 1.0)
molinillo (~> 0.6.6)
molinillo (~> 0.8.0)
nap (~> 1.0)
ruby-macho (~> 1.4)
xcodeproj (>= 1.11.1, < 2.0)
cocoapods-core (1.8.4)
activesupport (>= 4.0.2, < 6)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
concurrent-ruby (~> 1.1)
fuzzy_match (~> 2.0.4)
nap (~> 1.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.3.0)
netrc (~> 0.11)
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (2.1)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.0)
cocoapods-stats (1.1.0)
cocoapods-trunk (1.4.1)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
nap (>= 0.8, < 2.0)
netrc (~> 0.11)
cocoapods-try (1.1.0)
cocoapods-try (1.2.0)
colored (1.2)
colored2 (3.1.2)
commander-fastlane (4.4.6)
highline (~> 1.7.2)
concurrent-ruby (1.1.5)
declarative (0.0.10)
declarative-option (0.1.0)
digest-crc (0.4.1)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.3)
declarative (0.0.20)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.5.20190701)
unf (>= 0.0.5, < 1.0.0)
dotenv (2.7.5)
emoji_regex (1.0.1)
dotenv (2.8.1)
emoji_regex (3.2.3)
escape (0.0.4)
excon (0.71.1)
faraday (0.17.3)
multipart-post (>= 1.2, < 3)
faraday-cookie_jar (0.0.6)
faraday (>= 0.7.4)
ethon (0.16.0)
ffi (>= 1.15.0)
excon (0.109.0)
faraday (1.10.3)
faraday-em_http (~> 1.0)
faraday-em_synchrony (~> 1.0)
faraday-excon (~> 1.1)
faraday-httpclient (~> 1.0)
faraday-multipart (~> 1.0)
faraday-net_http (~> 1.0)
faraday-net_http_persistent (~> 1.0)
faraday-patron (~> 1.0)
faraday-rack (~> 1.0)
faraday-retry (~> 1.0)
ruby2_keywords (>= 0.0.4)
faraday-cookie_jar (0.0.7)
faraday (>= 0.8.0)
http-cookie (~> 1.0.0)
faraday_middleware (0.13.1)
faraday (>= 0.7.4, < 1.0)
fastimage (2.1.7)
fastlane (2.139.0)
faraday-em_http (1.0.0)
faraday-em_synchrony (1.0.0)
faraday-excon (1.1.0)
faraday-httpclient (1.0.1)
faraday-multipart (1.0.4)
multipart-post (~> 2)
faraday-net_http (1.0.1)
faraday-net_http_persistent (1.2.0)
faraday-patron (1.0.0)
faraday-rack (1.0.0)
faraday-retry (1.0.3)
faraday_middleware (1.2.0)
faraday (~> 1.0)
fastimage (2.3.0)
fastlane (2.219.0)
CFPropertyList (>= 2.3, < 4.0.0)
addressable (>= 2.3, < 3.0.0)
babosa (>= 1.0.2, < 2.0.0)
addressable (>= 2.8, < 3.0.0)
artifactory (~> 3.0)
aws-sdk-s3 (~> 1.0)
babosa (>= 1.0.3, < 2.0.0)
bundler (>= 1.12.0, < 3.0.0)
colored
commander-fastlane (>= 4.4.6, < 5.0.0)
commander (~> 4.6)
dotenv (>= 2.1.1, < 3.0.0)
emoji_regex (>= 0.1, < 2.0)
emoji_regex (>= 0.1, < 4.0)
excon (>= 0.71.0, < 1.0.0)
faraday (~> 0.17)
faraday (~> 1.0)
faraday-cookie_jar (~> 0.0.6)
faraday_middleware (~> 0.13.1)
faraday_middleware (~> 1.0)
fastimage (>= 2.1.0, < 3.0.0)
gh_inspector (>= 1.1.2, < 2.0.0)
google-api-client (>= 0.29.2, < 0.37.0)
google-cloud-storage (>= 1.15.0, < 2.0.0)
highline (>= 1.7.2, < 2.0.0)
google-apis-androidpublisher_v3 (~> 0.3)
google-apis-playcustomapp_v1 (~> 0.1)
google-cloud-env (>= 1.6.0, < 2.0.0)
google-cloud-storage (~> 1.31)
highline (~> 2.0)
http-cookie (~> 1.0.5)
json (< 3.0.0)
jwt (~> 2.1.0)
jwt (>= 2.1.0, < 3)
mini_magick (>= 4.9.4, < 5.0.0)
multi_xml (~> 0.5)
multipart-post (~> 2.0.0)
multipart-post (>= 2.0.0, < 3.0.0)
naturally (~> 2.2)
optparse (>= 0.1.1)
plist (>= 3.1.0, < 4.0.0)
public_suffix (~> 2.0.0)
rubyzip (>= 1.3.0, < 2.0.0)
rubyzip (>= 2.0.0, < 3.0.0)
security (= 0.1.3)
simctl (~> 1.6.3)
slack-notifier (>= 2.0.0, < 3.0.0)
terminal-notifier (>= 2.0.0, < 3.0.0)
terminal-table (>= 1.4.5, < 2.0.0)
terminal-table (~> 3)
tty-screen (>= 0.6.3, < 1.0.0)
tty-spinner (>= 0.8.0, < 1.0.0)
word_wrap (~> 1.0.0)
xcodeproj (>= 1.13.0, < 2.0.0)
xcpretty (~> 0.3.0)
xcpretty-travis-formatter (>= 0.0.3)
ffi (1.16.3)
fourflusher (2.3.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
google-api-client (0.36.3)
google-apis-androidpublisher_v3 (0.54.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-core (0.11.3)
addressable (~> 2.5, >= 2.5.1)
googleauth (~> 0.9)
httpclient (>= 2.8.1, < 3.0)
googleauth (>= 0.16.2, < 2.a)
httpclient (>= 2.8.1, < 3.a)
mini_mime (~> 1.0)
representable (~> 3.0)
retriable (>= 2.0, < 4.0)
signet (~> 0.12)
google-cloud-core (1.4.1)
google-cloud-env (~> 1.0)
google-cloud-env (1.3.0)
faraday (~> 0.11)
google-cloud-storage (1.25.0)
addressable (~> 2.5)
retriable (>= 2.0, < 4.a)
rexml
google-apis-iamcredentials_v1 (0.17.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-playcustomapp_v1 (0.13.0)
google-apis-core (>= 0.11.0, < 2.a)
google-apis-storage_v1 (0.29.0)
google-apis-core (>= 0.11.0, < 2.a)
google-cloud-core (1.6.1)
google-cloud-env (>= 1.0, < 3.a)
google-cloud-errors (~> 1.0)
google-cloud-env (1.6.0)
faraday (>= 0.17.3, < 3.0)
google-cloud-errors (1.3.1)
google-cloud-storage (1.45.0)
addressable (~> 2.8)
digest-crc (~> 0.4)
google-api-client (~> 0.33)
google-cloud-core (~> 1.2)
googleauth (~> 0.9)
google-apis-iamcredentials_v1 (~> 0.1)
google-apis-storage_v1 (~> 0.29.0)
google-cloud-core (~> 1.6)
googleauth (>= 0.16.2, < 2.a)
mini_mime (~> 1.0)
googleauth (0.10.0)
faraday (~> 0.12)
googleauth (1.8.1)
faraday (>= 0.17.3, < 3.a)
jwt (>= 1.4, < 3.0)
memoist (~> 0.16)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (~> 0.12)
highline (1.7.10)
http-cookie (1.0.3)
signet (>= 0.16, < 2.a)
highline (2.0.3)
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (0.9.5)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
json (2.3.0)
jwt (2.1.0)
memoist (0.16.2)
mini_magick (4.9.5)
mini_mime (1.0.2)
minitest (5.13.0)
molinillo (0.6.6)
multi_json (1.14.1)
multi_xml (0.6.0)
multipart-post (2.0.0)
nanaimo (0.2.6)
jmespath (1.6.2)
json (2.7.1)
jwt (2.8.1)
base64
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.22.2)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.4.0)
nanaimo (0.3.0)
nap (1.1.0)
naturally (2.2.0)
naturally (2.2.1)
netrc (0.11.0)
os (1.0.1)
plist (3.5.0)
public_suffix (2.0.5)
representable (3.0.4)
nkf (0.2.0)
optparse (0.4.0)
os (1.1.4)
plist (3.7.1)
public_suffix (4.0.7)
rake (13.1.0)
representable (3.2.0)
declarative (< 0.1.0)
declarative-option (< 0.2.0)
trailblazer-option (>= 0.1.1, < 0.2.0)
uber (< 0.2.0)
retriable (3.1.2)
rexml (3.2.6)
rouge (2.0.7)
ruby-macho (1.4.0)
rubyzip (1.3.0)
ruby-macho (2.5.1)
ruby2_keywords (0.0.5)
rubyzip (2.3.2)
security (0.1.3)
signet (0.12.0)
addressable (~> 2.3)
faraday (~> 0.9)
signet (0.18.0)
addressable (~> 2.8)
faraday (>= 0.17.5, < 3.a)
jwt (>= 1.5, < 3.0)
multi_json (~> 1.10)
simctl (1.6.7)
simctl (1.6.10)
CFPropertyList
naturally
slack-notifier (2.3.2)
terminal-notifier (2.0.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
thread_safe (0.3.6)
tty-cursor (0.7.0)
tty-screen (0.7.0)
tty-spinner (0.9.2)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
trailblazer-option (0.1.2)
tty-cursor (0.7.1)
tty-screen (0.8.2)
tty-spinner (0.9.3)
tty-cursor (~> 0.7)
tzinfo (1.2.6)
thread_safe (~> 0.1)
typhoeus (1.4.1)
ethon (>= 0.9.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uber (0.1.0)
unf (0.1.4)
unf_ext
unf_ext (0.0.7.6)
unicode-display_width (1.6.0)
unf_ext (0.0.9.1)
unicode-display_width (2.5.0)
word_wrap (1.0.0)
xcodeproj (1.14.0)
xcodeproj (1.24.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.2.6)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
xcpretty (0.3.0)
rouge (~> 2.0.7)
xcpretty-travis-formatter (1.0.0)
xcpretty-travis-formatter (1.0.1)
xcpretty (~> 0.2, >= 0.0.7)
zeitwerk (2.6.13)
PLATFORMS
ruby
arm64-darwin-22
arm64-darwin-23
x86_64-darwin-20
x86_64-linux
DEPENDENCIES
cocoapods
fastlane
BUNDLED WITH
2.1.3
2.4.19
+1 -1
View File
@@ -2,7 +2,7 @@
Version 2.0, January 2004
http://www.apache.org/licenses/
Copyright (c) 2014-2016 Dalton Cherry.
Copyright (c) 2014-2023 Dalton Cherry.
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-16
View File
@@ -1,16 +0,0 @@
{
"object": {
"pins": [
{
"package": "swift-nio-zlib-support",
"repositoryURL": "https://github.com/apple/swift-nio-zlib-support.git",
"state": {
"branch": null,
"revision": "37760e9a52030bb9011972c5213c3350fa9d41fd",
"version": "1.0.0"
}
}
]
},
"version": 1
}
+8 -5
View File
@@ -1,4 +1,4 @@
// swift-tools-version:4.2
// swift-tools-version:5.3
//
// Package.Swift
@@ -27,11 +27,14 @@ let package = Package(
products: [
.library(name: "Starscream", targets: ["Starscream"])
],
dependencies: [
.package(url: "https://github.com/apple/swift-nio-zlib-support.git", from: "1.0.0")
],
dependencies: [],
targets: [
.target(name: "Starscream",
path: "Sources")
path: "Sources",
resources: [.copy("PrivacyInfo.xcprivacy")])
]
)
#if os(Linux)
package.dependencies.append(.package(url: "https://github.com/apple/swift-nio-zlib-support.git", from: "1.0.0"))
#endif
+39 -58
View File
@@ -1,10 +1,10 @@
![starscream](https://raw.githubusercontent.com/daltoniam/starscream/assets/starscream.jpg)
Starscream is a conforming WebSocket ([RFC 6455](http://tools.ietf.org/html/rfc6455)) library in Swift.
Starscream is a conforming WebSocket ([RFC 6455](https://datatracker.ietf.org/doc/html/rfc6455)) library in Swift.
## Features
- Conforms to all of the base [Autobahn test suite](http://autobahn.ws/testsuite/).
- Conforms to all of the base [Autobahn test suite](https://crossbar.io/autobahn/).
- Nonblocking. Everything happens in the background, thanks to GCD.
- TLS/WSS support.
- Compression Extensions support ([RFC 7692](https://tools.ietf.org/html/rfc7692))
@@ -22,7 +22,9 @@ import Starscream
Once imported, you can open a connection to your WebSocket server. Note that `socket` is probably best as a property, so it doesn't get deallocated right after being setup.
```swift
socket = WebSocket(url: URL(string: "ws://localhost:8080/")!)
var request = URLRequest(url: URL(string: "http://localhost:8080")!)
request.timeoutInterval = 5
socket = WebSocket(request: request)
socket.delegate = self
socket.connect()
```
@@ -50,7 +52,7 @@ func didReceive(event: WebSocketEvent, client: WebSocket) {
break
case .pong(_):
break
case .viablityChanged(_):
case .viabilityChanged(_):
break
case .reconnectSuggested(_):
break
@@ -59,6 +61,8 @@ func didReceive(event: WebSocketEvent, client: WebSocket) {
case .error(let error):
isConnected = false
handleError(error)
case .peerClosed:
break
}
}
```
@@ -101,7 +105,6 @@ socket.write(ping: Data()) //example on how to write a ping control frame over t
### write a pong frame
the writePong method is the same as writePing, but sends a pong control frame.
```swift
@@ -150,15 +153,25 @@ let socket = WebSocket(request: request)
SSL Pinning is also supported in Starscream.
Allow Self-signed certificates:
```swift
var request = URLRequest(url: URL(string: "ws://localhost:8080/")!)
let pinner = FoundationSecurity(allowSelfSigned: true) // don't validate SSL certificates
let socket = WebSocket(request: request, certPinner: pinner)
```
TODO: Update docs on how to load certificates and public keys into an app bundle, use the builtin pinner and TrustKit.
### Compression Extensions
Compression Extensions ([RFC 7692](https://tools.ietf.org/html/rfc7692)) is supported in Starscream. Compression is enabled by default, however compression will only be used if it is supported by the server as well. You may enable or disable compression via the `.enableCompression` property:
Compression Extensions ([RFC 7692](https://tools.ietf.org/html/rfc7692)) is supported in Starscream. Compression is enabled by default, however compression will only be used if it is supported by the server as well. You may enable compression by adding a `compressionHandler`:
```swift
socket = WebSocket(url: URL(string: "ws://localhost:8080/")!)
socket.enableCompression = false
var request = URLRequest(url: URL(string: "ws://localhost:8080/")!)
let compression = WSCompression()
let socket = WebSocket(request: request, compressionHandler: compression)
```
Compression should be disabled if your application is transmitting already-compressed, random, or other uncompressable data.
@@ -183,6 +196,18 @@ Starscream works with iOS 8/10.10 or above for CocoaPods/framework support. To u
## Installation
### Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
Once you have your Swift package set up, adding Starscream as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```swift
dependencies: [
.package(url: "https://github.com/daltoniam/Starscream.git", from: "4.0.6")
]
```
### CocoaPods
Check out [Get Started](http://cocoapods.org/) tab on [cocoapods.org](http://cocoapods.org/).
@@ -190,10 +215,10 @@ Check out [Get Started](http://cocoapods.org/) tab on [cocoapods.org](http://coc
To use Starscream in your project add the following 'Podfile' to your project
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
platform :ios, '12.0'
use_frameworks!
pod 'Starscream', '~> 4.0.0'
pod 'Starscream', '~> 4.0.6'
Then run:
@@ -215,54 +240,7 @@ $ brew install carthage
To integrate Starscream into your Xcode project using Carthage, specify it in your `Cartfile`:
```
github "daltoniam/Starscream" >= 4.0.0
```
### Accio
Check out the [Accio](https://github.com/JamitLabs/Accio) docs on how to add a install.
Add the following to your Package.swift:
```swift
.package(url: "https://github.com/daltoniam/Starscream.git", .upToNextMajor(from: "4.0.0")),
```
Next, add `Starscream` to your App targets dependencies like so:
```swift
.target(
name: "App",
dependencies: [
"Starscream",
]
),
```
Then run `accio update`.
### Rogue
First see the [installation docs](https://github.com/acmacalister/Rogue) for how to install Rogue.
To install Starscream run the command below in the directory you created the rogue file.
```
rogue add https://github.com/daltoniam/Starscream
```
Next open the `libs` folder and add the `Starscream.xcodeproj` to your Xcode project. Once that is complete, in your "Build Phases" add the `Starscream.framework` to your "Link Binary with Libraries" phase. Make sure to add the `libs` folder to your `.gitignore` file.
### Swift Package Manager
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
Once you have your Swift package set up, adding Starscream as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
```swift
dependencies: [
.Package(url: "https://github.com/daltoniam/Starscream.git", majorVersion: 4)
]
github "daltoniam/Starscream" >= 4.0.6
```
### Other
@@ -278,6 +256,9 @@ If you are running this in an OSX app or on a physical iOS device you will need
## TODOs
- [ ] Proxy support
- [ ] Thread safe implementation
- [ ] Better testing/CI
- [ ] SSL Pinning/client auth examples
## License
+19 -6
View File
@@ -44,6 +44,10 @@ public class WSCompression: CompressionHandler {
guard let extensionHeader = headers[headerWSExtensionName] else { return }
decompressorTakeOver = false
compressorTakeOver = false
// assume defaults unless the headers say otherwise
compressor = Compressor(windowBits: 15)
decompressor = Decompressor(windowBits: 15)
let parts = extensionHeader.components(separatedBy: ";")
for p in parts {
@@ -147,10 +151,12 @@ class Decompressor {
strm.avail_in = CUnsignedInt(count)
repeat {
strm.next_out = UnsafeMutablePointer<UInt8>(&buffer)
strm.avail_out = CUnsignedInt(buffer.count)
buffer.withUnsafeMutableBytes { (bufferPtr) in
strm.next_out = bufferPtr.bindMemory(to: UInt8.self).baseAddress
strm.avail_out = CUnsignedInt(bufferPtr.count)
res = inflate(&strm, 0)
res = inflate(&strm, 0)
}
let byteCount = buffer.count - Int(strm.avail_out)
out.append(buffer, count: byteCount)
@@ -202,6 +208,11 @@ class Compressor {
}
func compress(_ data: Data) throws -> Data {
guard !data.isEmpty else {
// For example, PONG has no content
return data
}
var compressed = Data()
var res: CInt = 0
data.withUnsafeBytes { (ptr:UnsafePointer<UInt8>) -> Void in
@@ -209,10 +220,12 @@ class Compressor {
strm.avail_in = CUnsignedInt(data.count)
repeat {
strm.next_out = UnsafeMutablePointer<UInt8>(&buffer)
strm.avail_out = CUnsignedInt(buffer.count)
buffer.withUnsafeMutableBytes { (bufferPtr) in
strm.next_out = bufferPtr.bindMemory(to: UInt8.self).baseAddress
strm.avail_out = CUnsignedInt(bufferPtr.count)
res = deflate(&strm, Z_SYNC_FLUSH)
res = deflate(&strm, Z_SYNC_FLUSH)
}
let byteCount = buffer.count - Int(strm.avail_out)
compressed.append(buffer, count: byteCount)
+5 -9
View File
@@ -27,22 +27,20 @@ import Foundation
internal extension Data {
struct ByteError: Swift.Error {}
#if swift(>=5.0)
func withUnsafeBytes<ResultType, ContentType>(_ completion: (UnsafePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
#if swift(>=5.0)
return try withUnsafeBytes {
return try withUnsafeBytes {
if let baseAddress = $0.baseAddress, $0.count > 0 {
return try completion(baseAddress.assumingMemoryBound(to: ContentType.self))
} else {
throw ByteError()
}
}
#else
return try withUnsafeBytes(completion)
#endif
}
#endif
#if swift(>=5.0)
mutating func withUnsafeMutableBytes<ResultType, ContentType>(_ completion: (UnsafeMutablePointer<ContentType>) throws -> ResultType) rethrows -> ResultType {
#if swift(>=5.0)
return try withUnsafeMutableBytes {
if let baseAddress = $0.baseAddress, $0.count > 0 {
return try completion(baseAddress.assumingMemoryBound(to: ContentType.self))
@@ -50,8 +48,6 @@ internal extension Data {
throw ByteError()
}
}
#else
return try withUnsafeMutableBytes(completion)
#endif
}
#endif
}
+16 -2
View File
@@ -1,14 +1,28 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// Engine.swift
// Starscream
//
// Created by Dalton Cherry on 6/15/19.
// Created by Dalton Cherry on 6/15/19
// Copyright © 2019 Vluxe. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
import Foundation
public protocol EngineDelegate: class {
public protocol EngineDelegate: AnyObject {
func didReceive(event: WebSocketEvent)
}
+108 -83
View File
@@ -1,90 +1,115 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// NativeEngine.swift
// Starscream
//
// Created by Dalton Cherry on 6/15/19.
// Created by Dalton Cherry on 6/15/19
// Copyright © 2019 Vluxe. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
//import Foundation
//
//@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
//public class NativeEngine: Engine {
// private var task: URLSessionWebSocketTask?
// weak var delegate: EngineDelegate?
//
// public init() {
// //TODO: I probably need to drop down into the NWConnection APIs to get this to work with all of Starscream's features
// //
// //NOTE: URLSessionWebSocketTask doesn't work with our ruby web server in the SimpleTest example.
// //It allows crashes. It works fine with https://echo.websocket.org in either http or https. Not sure why though
// //needs more debugging and probably needs radar filed.
// }
//
// public func register(delegate: EngineDelegate) {
// self.delegate = delegate
// }
//
// public func start(request: URLRequest) {
// task = URLSession.shared.webSocketTask(with: request)
// doRead()
// task?.resume()
// }
//
// public func stop(closeCode: UInt16) {
// let closeCode = URLSessionWebSocketTask.CloseCode(rawValue: Int(closeCode)) ?? .normalClosure
// task?.cancel(with: closeCode, reason: nil)
// }
//
// public func forceStop() {
// stop(closeCode: UInt16(URLSessionWebSocketTask.CloseCode.abnormalClosure.rawValue))
// }
//
// public func write(string: String, completion: (() -> ())?) {
// task?.send(.string(string), completionHandler: { (error) in
// completion?()
// })
// }
//
// public func write(data: Data, opcode: FrameOpCode, completion: (() -> ())?) {
// switch opcode {
// case .binaryFrame:
// task?.send(.data(data), completionHandler: { (error) in
// completion?()
// })
// case .textFrame:
// let text = String(data: data, encoding: .utf8)!
// write(string: text, completion: completion)
// case .ping:
// task?.sendPing(pongReceiveHandler: { (error) in
// completion?()
// })
// default:
// break //unsupported
// }
// }
//
// private func doRead() {
// task?.receive { [weak self] (result) in
// switch result {
// case .success(let message):
// switch message {
// case .string(let string):
// self?.broadcast(event: .text(string))
// case .data(let data):
// self?.broadcast(event: .binary(data))
// @unknown default:
// break
// }
// break
// case .failure(let error):
// self?.broadcast(event: .error(error))
// }
// self?.doRead()
// }
// }
//
// private func broadcast(event: WebSocketEvent) {
// delegate?.didReceive(event: event)
// }
//}
import Foundation
@available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
public class NativeEngine: NSObject, Engine, URLSessionDataDelegate, URLSessionWebSocketDelegate {
private var task: URLSessionWebSocketTask?
weak var delegate: EngineDelegate?
public func register(delegate: EngineDelegate) {
self.delegate = delegate
}
public func start(request: URLRequest) {
let session = URLSession(configuration: URLSessionConfiguration.default, delegate: self, delegateQueue: nil)
task = session.webSocketTask(with: request)
doRead()
task?.resume()
}
public func stop(closeCode: UInt16) {
let closeCode = URLSessionWebSocketTask.CloseCode(rawValue: Int(closeCode)) ?? .normalClosure
task?.cancel(with: closeCode, reason: nil)
}
public func forceStop() {
stop(closeCode: UInt16(URLSessionWebSocketTask.CloseCode.abnormalClosure.rawValue))
}
public func write(string: String, completion: (() -> ())?) {
task?.send(.string(string), completionHandler: { (error) in
completion?()
})
}
public func write(data: Data, opcode: FrameOpCode, completion: (() -> ())?) {
switch opcode {
case .binaryFrame:
task?.send(.data(data), completionHandler: { (error) in
completion?()
})
case .textFrame:
let text = String(data: data, encoding: .utf8)!
write(string: text, completion: completion)
case .ping:
task?.sendPing(pongReceiveHandler: { (error) in
completion?()
})
default:
break //unsupported
}
}
private func doRead() {
task?.receive { [weak self] (result) in
switch result {
case .success(let message):
switch message {
case .string(let string):
self?.broadcast(event: .text(string))
case .data(let data):
self?.broadcast(event: .binary(data))
@unknown default:
break
}
break
case .failure(let error):
self?.broadcast(event: .error(error))
return
}
self?.doRead()
}
}
private func broadcast(event: WebSocketEvent) {
delegate?.didReceive(event: event)
}
public func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didOpenWithProtocol protocol: String?) {
let p = `protocol` ?? ""
broadcast(event: .connected([HTTPWSHeader.protocolName: p]))
}
public func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didCloseWith closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) {
var r = ""
if let d = reason {
r = String(data: d, encoding: .utf8) ?? ""
}
broadcast(event: .disconnected(r, UInt16(closeCode.rawValue)))
}
public func urlSession(_ session: URLSession, task: URLSessionTask, didCompleteWithError error: Error?) {
broadcast(event: .error(error))
}
}
+40 -3
View File
@@ -1,10 +1,24 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// WSEngine.swift
// Starscream
//
// Created by Dalton Cherry on 6/15/19.
// Created by Dalton Cherry on 6/15/19
// Copyright © 2019 Vluxe. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
import Foundation
@@ -24,6 +38,7 @@ FrameCollectorDelegate, HTTPHandlerDelegate {
private let writeQueue = DispatchQueue(label: "com.vluxe.starscream.writequeue")
private let mutex = DispatchSemaphore(value: 1)
private var canSend = false
private var isConnecting = false
weak var delegate: EngineDelegate?
public var respondToPingWithPong: Bool = true
@@ -50,9 +65,10 @@ FrameCollectorDelegate, HTTPHandlerDelegate {
public func start(request: URLRequest) {
mutex.wait()
let isConnecting = self.isConnecting
let isConnected = canSend
mutex.signal()
if isConnected {
if isConnecting || isConnected {
return
}
@@ -64,6 +80,9 @@ FrameCollectorDelegate, HTTPHandlerDelegate {
guard let url = request.url else {
return
}
mutex.wait()
self.isConnecting = true
mutex.signal()
transport.connect(url: url, timeout: request.timeoutInterval, certificatePinning: certPinner)
}
@@ -79,6 +98,10 @@ FrameCollectorDelegate, HTTPHandlerDelegate {
}
public func forceStop() {
mutex.wait()
isConnecting = false
mutex.signal()
transport.disconnect()
}
@@ -125,7 +148,7 @@ FrameCollectorDelegate, HTTPHandlerDelegate {
case .failed(let error):
handleError(error)
case .viability(let isViable):
broadcast(event: .viablityChanged(isViable))
broadcast(event: .viabilityChanged(isViable))
case .shouldReconnect(let status):
broadcast(event: .reconnectSuggested(status))
case .receive(let data):
@@ -139,7 +162,13 @@ FrameCollectorDelegate, HTTPHandlerDelegate {
}
}
case .cancelled:
mutex.wait()
isConnecting = false
mutex.signal()
broadcast(event: .cancelled)
case .peerClosed:
broadcast(event: .peerClosed)
}
}
@@ -153,10 +182,17 @@ FrameCollectorDelegate, HTTPHandlerDelegate {
return
}
mutex.wait()
isConnecting = false
didUpgrade = true
canSend = true
mutex.signal()
compressionHandler?.load(headers: headers)
if let url = request.url {
HTTPCookie.cookies(withResponseHeaderFields: headers, for: url).forEach {
HTTPCookieStorage.shared.setCookie($0)
}
}
broadcast(event: .connected(headers))
case .failure(let error):
handleError(error)
@@ -219,6 +255,7 @@ FrameCollectorDelegate, HTTPHandlerDelegate {
private func reset() {
mutex.wait()
isConnecting = false
canSend = false
didUpgrade = false
mutex.signal()
+7 -6
View File
@@ -76,12 +76,6 @@ public class FoundationHTTPHandler: HTTPHandler {
return false //not enough data, wait for more
}
let code = CFHTTPMessageGetResponseStatusCode(response)
if code != HTTPWSHeader.switchProtocolCode {
delegate?.didReceiveHTTP(event: .failure(HTTPUpgradeError.notAnUpgrade(code)))
return true
}
if let cfHeaders = CFHTTPMessageCopyAllHeaderFields(response) {
let nsHeaders = cfHeaders.takeRetainedValue() as NSDictionary
var headers = [String: String]()
@@ -90,6 +84,13 @@ public class FoundationHTTPHandler: HTTPHandler {
headers[key] = value
}
}
let code = CFHTTPMessageGetResponseStatusCode(response)
if code != HTTPWSHeader.switchProtocolCode {
delegate?.didReceiveHTTP(event: .failure(HTTPUpgradeError.notAnUpgrade(code, headers)))
return true
}
delegate?.didReceiveHTTP(event: .success(headers))
return true
}
@@ -74,7 +74,7 @@ public class FoundationHTTPServerHandler: HTTPServerHandler {
return false //not enough data, wait for more
}
if let method = CFHTTPMessageCopyRequestMethod(response)?.takeRetainedValue() {
if method != getVerb {
if (method as NSString) != getVerb {
delegate?.didReceive(event: .failure(HTTPUpgradeError.invalidData))
return true
}
+8 -12
View File
@@ -22,7 +22,7 @@
import Foundation
public protocol FrameCollectorDelegate: class {
public protocol FrameCollectorDelegate: AnyObject {
func didForm(event: FrameCollector.Event)
func decompress(data: Data, isFinal: Bool) -> Data?
}
@@ -84,19 +84,15 @@ public class FrameCollector {
}
buffer.append(payload)
frameCount += 1
if isText {
if String(data: buffer, encoding: .utf8) == nil {
let errCode = CloseCode.protocolError.rawValue
delegate?.didForm(event: .error(WSError(type: .protocolError, message: "not valid UTF-8 data", code: errCode)))
reset()
return
}
}
if frame.isFin {
if isText {
let string = String(data: buffer, encoding: .utf8) ?? ""
delegate?.didForm(event: .text(string))
if let string = String(data: buffer, encoding: .utf8) {
delegate?.didForm(event: .text(string))
} else {
let errCode = CloseCode.protocolError.rawValue
delegate?.didForm(event: .error(WSError(type: .protocolError, message: "not valid UTF-8 data", code: errCode)))
}
} else {
delegate?.didForm(event: .binary(buffer))
}
+5 -2
View File
@@ -71,7 +71,7 @@ public enum FrameEvent {
case error(Error)
}
public protocol FramerEventClient: class {
public protocol FramerEventClient: AnyObject {
func frameProcessed(event: FrameEvent)
}
@@ -159,7 +159,7 @@ public class WSFramer: Framer {
let errCode = CloseCode.protocolError.rawValue
return .failed(WSError(type: .protocolError, message: "masked and rsv data is not currently supported", code: errCode))
}
let isControlFrame = (opcode == .connectionClose || opcode == .ping)
let isControlFrame = (opcode == .connectionClose || opcode == .ping || opcode == .pong)
if !isControlFrame && (opcode != .binaryFrame && opcode != .continueFrame &&
opcode != .textFrame && opcode != .pong) {
let errCode = CloseCode.protocolError.rawValue
@@ -183,6 +183,9 @@ public class WSFramer: Framer {
closeCode = CloseCode.protocolError.rawValue
dataLength = 0
} else if payloadLen > 1 {
if pointer.count < 4 {
return .needsMoreData
}
let size = MemoryLayout<UInt16>.size
closeCode = pointer.readUint16(offset: offset)
offset += size
+12 -3
View File
@@ -23,7 +23,7 @@
import Foundation
public enum HTTPUpgradeError: Error {
case notAnUpgrade(Int)
case notAnUpgrade(Int, [String: String])
case invalidData
}
@@ -67,6 +67,15 @@ public struct HTTPWSHeader {
req.setValue(HTTPWSHeader.versionValue, forHTTPHeaderField: HTTPWSHeader.versionName)
req.setValue(secKeyValue, forHTTPHeaderField: HTTPWSHeader.keyName)
if req.allHTTPHeaderFields?["Cookie"] == nil {
if let cookies = HTTPCookieStorage.shared.cookies(for: url), !cookies.isEmpty {
let headers = HTTPCookie.requestHeaderFields(with: cookies)
for (key, val) in headers {
req.setValue(val, forHTTPHeaderField: key)
}
}
}
if supportsCompression {
let val = "permessage-deflate; client_max_window_bits; server_max_window_bits=15"
req.setValue(val, forHTTPHeaderField: HTTPWSHeader.extensionName)
@@ -87,7 +96,7 @@ public enum HTTPEvent {
case failure(Error)
}
public protocol HTTPHandlerDelegate: class {
public protocol HTTPHandlerDelegate: AnyObject {
func didReceiveHTTP(event: HTTPEvent)
}
@@ -97,7 +106,7 @@ public protocol HTTPHandler {
func parse(data: Data) -> Int
}
public protocol HTTPServerDelegate: class {
public protocol HTTPServerDelegate: AnyObject {
func didReceive(event: HTTPEvent)
}
+4 -5
View File
@@ -101,17 +101,16 @@ public class StringHTTPHandler: HTTPHandler {
code = c
}
} else {
let responseSplit = str.components(separatedBy: ":")
guard responseSplit.count > 1 else { break }
let key = responseSplit[0].trimmingCharacters(in: .whitespaces)
let val = responseSplit[1].trimmingCharacters(in: .whitespaces)
guard let separatorIndex = str.firstIndex(of: ":") else { break }
let key = str.prefix(upTo: separatorIndex).trimmingCharacters(in: .whitespaces)
let val = str.suffix(from: str.index(after: separatorIndex)).trimmingCharacters(in: .whitespaces)
headers[key.lowercased()] = val
}
i += 1
}
if code != HTTPWSHeader.switchProtocolCode {
delegate?.didReceiveHTTP(event: .failure(HTTPUpgradeError.notAnUpgrade(code)))
delegate?.didReceiveHTTP(event: .failure(HTTPUpgradeError.notAnUpgrade(code, headers)))
return true
}
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.0.0</string>
<string>$(MARKETING_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrivacyTracking</key>
<false/>
<key>NSPrivacyTrackingDomains</key>
<array/>
<key>NSPrivacyCollectedDataTypes</key>
<array/>
<key>NSPrivacyAccessedAPITypes</key>
<array/>
</dict>
</plist>
+1 -3
View File
@@ -44,9 +44,7 @@ extension FoundationSecurity: CertificatePinning {
return
}
if let validateDomain = domain {
SecTrustSetPolicies(trust, SecPolicyCreateSSL(true, validateDomain as NSString?))
}
SecTrustSetPolicies(trust, SecPolicyCreateSSL(true, domain as NSString?))
handleSecurityTrust(trust: trust, completion: completion)
}
+2 -2
View File
@@ -34,12 +34,12 @@ public enum PinningState {
// CertificatePinning protocol provides an interface for Transports to handle Certificate
// or Public Key Pinning.
public protocol CertificatePinning: class {
public protocol CertificatePinning: AnyObject {
func evaluateTrust(trust: SecTrust, domain: String?, completion: ((PinningState) -> ()))
}
// validates the "Sec-WebSocket-Accept" header as defined 1.3 of the RFC 6455
// https://tools.ietf.org/html/rfc6455#section-1.3
public protocol HeaderValidator: class {
public protocol HeaderValidator: AnyObject {
func validate(headers: [String: String], key: String) -> Error?
}
+1 -1
View File
@@ -36,7 +36,7 @@ public protocol Connection {
func write(data: Data, opcode: FrameOpCode)
}
public protocol ConnectionDelegate: class {
public protocol ConnectionDelegate: AnyObject {
func didReceive(event: ServerEvent)
}
+2
View File
@@ -138,6 +138,8 @@ public class ServerConnection: Connection, HTTPServerDelegate, FramerEventClient
case .cancelled:
print("server connection cancelled!")
//broadcast(event: .cancelled)
case .peerClosed:
delegate?.didReceive(event: .disconnected(self, "Connection closed by peer", UInt16(FrameOpCode.connectionClose.rawValue)))
}
}
+15 -3
View File
@@ -1,10 +1,24 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// Starscream.h
// Starscream
//
// Created by Austin Cherry on 9/25/14.
// Copyright (c) 2014 Vluxe. All rights reserved.
// Copyright © 2014 Vluxe. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
@@ -15,5 +29,3 @@ FOUNDATION_EXPORT double StarscreamVersionNumber;
FOUNDATION_EXPORT const unsigned char StarscreamVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <Starscream/PublicHeader.h>
+9 -15
View File
@@ -41,7 +41,7 @@ public struct WSError: Error {
}
}
public protocol WebSocketClient: class {
public protocol WebSocketClient: AnyObject {
func connect()
func disconnect(closeCode: UInt16)
func write(string: String, completion: (() -> ())?)
@@ -82,13 +82,14 @@ public enum WebSocketEvent {
case pong(Data?)
case ping(Data?)
case error(Error?)
case viablityChanged(Bool)
case viabilityChanged(Bool)
case reconnectSuggested(Bool)
case cancelled
case peerClosed
}
public protocol WebSocketDelegate: class {
func didReceive(event: WebSocketEvent, client: WebSocket)
public protocol WebSocketDelegate: AnyObject {
func didReceive(event: WebSocketEvent, client: WebSocketClient)
}
open class WebSocket: WebSocketClient, EngineDelegate {
@@ -110,22 +111,15 @@ open class WebSocket: WebSocketClient, EngineDelegate {
}
}
// serial write queue to ensure writes happen in order
private let writeQueue = DispatchQueue(label: "com.vluxe.starscream.writequeue")
private var canSend = false
private let mutex = DispatchSemaphore(value: 1)
public init(request: URLRequest, engine: Engine) {
self.request = request
self.engine = engine
}
public convenience init(request: URLRequest, certPinner: CertificatePinning? = FoundationSecurity(), compressionHandler: CompressionHandler? = nil) {
//TODO: will release once Xcode 11 is out of beta
// if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *) {
// self.init(request: request, engine: NativeEngine())
// } else
if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) {
public convenience init(request: URLRequest, certPinner: CertificatePinning? = FoundationSecurity(), compressionHandler: CompressionHandler? = nil, useCustomEngine: Bool = true) {
if #available(macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *), !useCustomEngine {
self.init(request: request, engine: NativeEngine())
} else if #available(macOS 10.14, iOS 12.0, watchOS 5.0, tvOS 12.0, *) {
self.init(request: request, engine: WSEngine(transport: TCPTransport(), certPinner: certPinner, compressionHandler: compressionHandler))
} else {
self.init(request: request, engine: WSEngine(transport: FoundationTransport(), certPinner: certPinner, compressionHandler: compressionHandler))
+12 -1
View File
@@ -47,7 +47,12 @@ public class FoundationTransport: NSObject, Transport, StreamDelegate {
onConnect = streamConfiguration
}
public func connect(url: URL, timeout: Double = 10, certificatePinning: CertificatePinning? = nil) {
deinit {
inputStream?.delegate = nil
outputStream?.delegate = nil
}
public func connect(url: URL, timeout: Double = 10, certificatePinning: CertificatePinning? = nil) {
guard let parts = url.getParts() else {
delegate?.connectionChanged(state: .failed(FoundationTransportError.invalidRequest))
return
@@ -66,6 +71,12 @@ public class FoundationTransport: NSObject, Transport, StreamDelegate {
inStream.delegate = self
outStream.delegate = self
if isTLS {
let key = CFStreamPropertyKey(rawValue: kCFStreamPropertySocketSecurityLevel)
CFReadStreamSetProperty(inStream, key, kCFStreamSocketSecurityLevelNegotiatedSSL)
CFWriteStreamSetProperty(outStream, key, kCFStreamSocketSecurityLevelNegotiatedSSL)
}
onConnect?(inStream, outStream)
isOpen = false
+24 -3
View File
@@ -35,7 +35,11 @@ public class TCPTransport: Transport {
private weak var delegate: TransportEventClient?
private var isRunning = false
private var isTLS = false
deinit {
disconnect()
}
public var usingTLS: Bool {
return self.isTLS
}
@@ -66,7 +70,7 @@ public class TCPTransport: Transport {
sec_protocol_verify_complete(true)
return
}
pinner.evaluateTrust(trust: trust, domain: url.absoluteString, completion: { (state) in
pinner.evaluateTrust(trust: trust, domain: parts.host, completion: { (state) in
switch state {
case .success:
sec_protocol_verify_complete(true)
@@ -85,6 +89,7 @@ public class TCPTransport: Transport {
public func disconnect() {
isRunning = false
connection?.cancel()
connection = nil
}
public func register(delegate: TransportEventClient) {
@@ -141,7 +146,23 @@ public class TCPTransport: Transport {
if let data = data {
s.delegate?.connectionChanged(state: .receive(data))
}
s.readLoop()
// Refer to https://developer.apple.com/documentation/network/implementing_netcat_with_network_framework
if let context = context, context.isFinal, isComplete {
if let delegate = s.delegate {
// Let the owner of this TCPTransport decide what to do next: disconnect or reconnect?
delegate.connectionChanged(state: .peerClosed)
} else {
// No use to keep connection alive
s.disconnect()
}
return
}
if error == nil {
s.readLoop()
}
})
}
}
+17 -9
View File
@@ -1,7 +1,5 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// Transport.swift
// Starscream
//
@@ -25,28 +23,38 @@
import Foundation
public enum ConnectionState {
/// Ready connections can send and receive data
case connected
/// Waiting connections have not yet been started, or do not have a viable network
case waiting
/// Cancelled connections have been invalidated by the client and will send no more events
case cancelled
/// Failed connections are disconnected and can no longer send or receive data
case failed(Error?)
//the viability (connection status) of the connection has updated
//e.g. connection is down, connection came back up, etc
/// Viability (connection status) of the connection has updated
/// e.g. connection is down, connection came back up, etc.
case viability(Bool)
//the connection has upgrade to wifi from cellular.
//you should consider reconnecting to take advantage of this
/// Connection ca be upgraded to wifi from cellular.
/// You should consider reconnecting to take advantage of this.
case shouldReconnect(Bool)
//the connection receive data
/// Received data
case receive(Data)
/// Remote peer has closed the network connection.
case peerClosed
}
public protocol TransportEventClient: class {
public protocol TransportEventClient: AnyObject {
func connectionChanged(state: ConnectionState)
}
public protocol Transport: class {
public protocol Transport: AnyObject {
func register(delegate: TransportEventClient)
func connect(url: URL, timeout: Double, certificatePinning: CertificatePinning?)
func disconnect()
+7 -4
View File
@@ -1,16 +1,19 @@
Pod::Spec.new do |s|
s.name = "Starscream"
s.version = "4.0.0"
s.version = "4.0.4"
s.summary = "A conforming WebSocket RFC 6455 client library in Swift."
s.homepage = "https://github.com/daltoniam/Starscream"
s.license = 'Apache License, Version 2.0'
s.author = {'Dalton Cherry' => 'http://daltoniam.com', 'Austin Cherry' => 'http://austincherry.me'}
s.source = { :git => 'https://github.com/daltoniam/Starscream.git', :tag => "#{s.version}"}
s.social_media_url = 'http://twitter.com/daltoniam'
s.ios.deployment_target = '8.0'
s.osx.deployment_target = '10.10'
s.tvos.deployment_target = '9.0'
s.ios.deployment_target = '12.0'
s.osx.deployment_target = '10.13'
s.tvos.deployment_target = '12.0'
s.watchos.deployment_target = '2.0'
s.source_files = 'Sources/**/*.swift'
s.swift_version = '5.0'
s.resource_bundles = {
'Starscream_Privacy' => ['Sources/PrivacyInfo.xcprivacy'],
}
end
+95 -23
View File
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 54;
objects = {
/* Begin PBXBuildFile section */
@@ -36,8 +36,19 @@
8A906E3F2208C7E80015057D /* WSCompression.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A906E3E2208C7E80015057D /* WSCompression.swift */; };
8ABD4470224C036A00FB8370 /* Data+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8ABD446F224C036A00FB8370 /* Data+Extensions.swift */; };
BBB5ABE8215E2217005B48B6 /* WebSocket.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBB5ABE4215E2217005B48B6 /* WebSocket.swift */; };
FC7E667D2B90B3AD00881886 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = FC7E667C2B90B3AD00881886 /* PrivacyInfo.xcprivacy */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
6B0BE7AA24A157BB0051F7A7 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 6B3E79DD19D48B7F006071F7 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 33CCF0841F5DDC030099B092;
remoteInfo = Starscream;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
335FA2021F5DF71D00F6D2EC /* Starscream Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Starscream Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
33CCF0921F5DDC030099B092 /* Starscream.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Starscream.framework; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -70,6 +81,7 @@
BBB5ABE4215E2217005B48B6 /* WebSocket.swift */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.swift; name = WebSocket.swift; path = Starscream/WebSocket.swift; sourceTree = "<group>"; tabWidth = 4; };
D88EAF811ED4DFD3004FE2C3 /* libz.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libz.tbd; path = usr/lib/libz.tbd; sourceTree = SDKROOT; };
D88EAF831ED4E7D8004FE2C3 /* CompressionTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CompressionTests.swift; sourceTree = "<group>"; };
FC7E667C2B90B3AD00881886 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -150,6 +162,7 @@
6B3E79E919D48B7F006071F7 /* Supporting Files */ = {
isa = PBXGroup;
children = (
FC7E667C2B90B3AD00881886 /* PrivacyInfo.xcprivacy */,
5C13600C1C473BFE00AA3A01 /* Info.plist */,
);
name = "Supporting Files";
@@ -250,6 +263,7 @@
buildRules = (
);
dependencies = (
6B0BE7AB24A157BB0051F7A7 /* PBXTargetDependency */,
);
name = "Starscream Tests";
productName = StarscreamTests;
@@ -280,9 +294,10 @@
6B3E79DD19D48B7F006071F7 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 1020;
LastUpgradeCheck = 1530;
ORGANIZATIONNAME = Vluxe;
TargetAttributes = {
335FA1F41F5DF71D00F6D2EC = {
@@ -298,8 +313,8 @@
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
mainGroup = 6B3E79DC19D48B7F006071F7;
productRefGroup = 6B3E79E719D48B7F006071F7 /* Products */;
@@ -324,6 +339,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
FC7E667D2B90B3AD00881886 /* PrivacyInfo.xcprivacy in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -372,6 +388,14 @@
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
6B0BE7AB24A157BB0051F7A7 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 33CCF0841F5DDC030099B092 /* Starscream */;
targetProxy = 6B0BE7AA24A157BB0051F7A7 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
335FA2001F5DF71D00F6D2EC /* Debug */ = {
isa = XCBuildConfiguration;
@@ -379,13 +403,24 @@
APPLICATION_EXTENSION_API_ONLY = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "-";
DEAD_CODE_STRIPPING = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.vluxe.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvos appletvsimulator macosx";
@@ -403,15 +438,27 @@
APPLICATION_EXTENSION_API_ONLY = NO;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "-";
DEAD_CODE_STRIPPING = YES;
INFOPLIST_FILE = "$(SRCROOT)/Tests/Info.plist";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks @executable_path/../Frameworks @loader_path/../Frameworks";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
"@executable_path/../Frameworks",
"@loader_path/../Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.vluxe.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos appletvos appletvsimulator macosx";
SUPPORTS_MACCATALYST = YES;
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_INSTALL_OBJC_HEADER = NO;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 5.0;
};
@@ -422,15 +469,24 @@
buildSettings = {
BITCODE_GENERATION_MODE = marker;
CLANG_ENABLE_MODULES = YES;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 4.0.4;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
OTHER_LDFLAGS = "-all_load";
PRODUCT_BUNDLE_IDENTIFIER = "com.vluxe.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -439,7 +495,7 @@
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 12.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
name = Debug;
@@ -449,24 +505,34 @@
buildSettings = {
BITCODE_GENERATION_MODE = bitcode;
CLANG_ENABLE_MODULES = YES;
DEAD_CODE_STRIPPING = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
ENABLE_MODULE_VERIFIER = YES;
INFOPLIST_FILE = "$(SRCROOT)/Sources/Info.plist";
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = "$(RECOMMENDED_MACOSX_DEPLOYMENT_TARGET)";
MARKETING_VERSION = 4.0.4;
MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu99 gnu++11";
OTHER_LDFLAGS = "-all_load";
PRODUCT_BUNDLE_IDENTIFIER = "com.vluxe.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
SUPPORTS_MACCATALYST = YES;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_OPTIMIZATION_LEVEL = "-O";
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
SWIFT_VERSION = 5.0;
TVOS_DEPLOYMENT_TARGET = 9.0;
TVOS_DEPLOYMENT_TARGET = 12.0;
WATCHOS_DEPLOYMENT_TARGET = 2.0;
};
name = Release;
@@ -495,6 +561,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -502,8 +569,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@@ -519,13 +588,13 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchsimulator watchos";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchsimulator watchos xros xrsimulator";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
@@ -555,6 +624,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
@@ -562,8 +632,10 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = YES;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = YES;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_USER_SCRIPT_SANDBOXING = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@@ -572,11 +644,11 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchsimulator watchos";
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator watchsimulator watchos xros xrsimulator";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,4";
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1020"
LastUpgradeVersion = "1530"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
@@ -26,8 +26,17 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
codeCoverageEnabled = "YES"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "YES"
codeCoverageEnabled = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CCF0841F5DDC030099B092"
BuildableName = "Starscream.framework"
BlueprintName = "Starscream"
ReferencedContainer = "container:Starscream.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
<TestableReference
skipped = "NO">
@@ -44,17 +53,6 @@
</LocationScenarioReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CCF0841F5DDC030099B092"
BuildableName = "Starscream.framework"
BlueprintName = "Starscream"
ReferencedContainer = "container:Starscream.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
@@ -75,8 +73,6 @@
ReferencedContainer = "container:Starscream.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
+17 -1
View File
@@ -1,3 +1,4 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// FuzzingTests.swift
// Starscream
@@ -5,6 +6,19 @@
// Created by Dalton Cherry on 1/28/19.
// Copyright © 2019 Vluxe. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
import XCTest
@testable import Starscream
@@ -60,12 +74,14 @@ class FuzzingTests: XCTestCase {
print("reason: \(reason) code: \(code)")
case .error(_):
break
case .viablityChanged(_):
case .viabilityChanged(_):
break
case .reconnectSuggested(_):
break
case .cancelled:
break
case .peerClosed:
break
}
}
websocket.connect()
+14
View File
@@ -1,3 +1,4 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// MockServer.swift
// Starscream
@@ -5,6 +6,19 @@
// Created by Dalton Cherry on 1/29/19.
// Copyright © 2019 Vluxe. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
import Foundation
@testable import Starscream
+15 -1
View File
@@ -1,10 +1,24 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// MockTransport.swift
// Starscream
//
// Created by Dalton Cherry on 1/28/19.
// Created by Dalton Cherry on 1/29/19.
// Copyright © 2019 Vluxe. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
import Foundation
@testable import Starscream
+15 -1
View File
@@ -1,10 +1,24 @@
//////////////////////////////////////////////////////////////////////////////////////////////////
//
// StarscreamTests.swift
// StarscreamTests
//
// Created by Austin Cherry on 9/25/14.
// Copyright (c) 2014 Vluxe. All rights reserved.
// Copyright © 2014 Vluxe. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
//////////////////////////////////////////////////////////////////////////////////////////////////
import XCTest
-6
View File
@@ -1,6 +0,0 @@
#!/bin/bash
set -o pipefail && xcodebuild -project Starscream.xcodeproj -scheme Starscream CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO build | xcpretty
swift build
pod repo update
pod lib lint --verbose --allow-warnings
@@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objectVersion = 53;
objects = {
/* Begin PBXBuildFile section */
@@ -160,9 +160,10 @@
5C178E141B62D0B900A97204 /* Project object */ = {
isa = PBXProject;
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0640;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = vluxe;
TargetAttributes = {
5C178E1B1B62D0B900A97204 = {
@@ -173,10 +174,9 @@
};
buildConfigurationList = 5C178E171B62D0B900A97204 /* Build configuration list for PBXProject "Autobahn" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
developmentRegion = en;
hasScannedForEncodings = 0;
knownRegions = (
English,
en,
Base,
);
@@ -275,23 +275,36 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
@@ -307,7 +320,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
@@ -320,17 +333,29 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -346,9 +371,10 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.4;
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
SWIFT_COMPILATION_MODE = wholemodule;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
};
@@ -361,7 +387,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Autobahn/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.vluxe.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
@@ -374,7 +405,12 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
DEVELOPMENT_TEAM = "";
INFOPLIST_FILE = Autobahn/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 12.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
);
PRODUCT_BUNDLE_IDENTIFIER = "com.vluxe.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
};
+1 -1
View File
@@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>com.vluxe.$(PRODUCT_NAME:rfc1034identifier)</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
@@ -30,21 +30,8 @@ class ViewController: UIViewController, WebSocketDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// let err = server.start(address: "localhost", port: 8080)
// if err != nil {
// print("server didn't start!")
// }
// server.onEvent = { event in
// switch event {
// case .text(let conn, let string):
// let payload = string.data(using: .utf8)!
// conn.write(data: payload, opcode: .textFrame)
// default:
// break
// }
// }
//https://echo.websocket.org
var request = URLRequest(url: URL(string: "http://localhost:8080")!)//https://localhost:8080
var request = URLRequest(url: URL(string: "http://localhost:8080")!) //https://localhost:8080
request.timeoutInterval = 5
socket = WebSocket(request: request)
socket.delegate = self
@@ -52,7 +39,7 @@ class ViewController: UIViewController, WebSocketDelegate {
}
// MARK: - WebSocketDelegate
func didReceive(event: WebSocketEvent, client: WebSocket) {
func didReceive(event: Starscream.WebSocketEvent, client: Starscream.WebSocketClient) {
switch event {
case .connected(let headers):
isConnected = true
@@ -68,7 +55,7 @@ class ViewController: UIViewController, WebSocketDelegate {
break
case .pong(_):
break
case .viablityChanged(_):
case .viabilityChanged(_):
break
case .reconnectSuggested(_):
break
@@ -77,6 +64,8 @@ class ViewController: UIViewController, WebSocketDelegate {
case .error(let error):
isConnected = false
handleError(error)
case .peerClosed:
break
}
}
+13 -12
View File
@@ -2,27 +2,28 @@ default_platform(:ios)
update_fastlane
desc "Run tests"
lane :test do
run_tests(
devices: ["iPhone 14 Pro", "iPad Pro (11-inch) (4th generation)"],
)
end
platform :ios do
desc "Deploy new version"
lane :release do
ensure_git_branch
version = version_get_podspec(path: "Starscream.podspec")
changelog = prompt(text: "Changelog: ", multi_line_end_keyword: "END")
github_token = ENV['GITHUB_TOKEN']
if !github_token || github_token.empty?
github_token = prompt(text: "Please enter your GitHub token: ")
end
version = version_bump_podspec(path: "Starscream.podspec", version_number: ENV["TAG"])
changelog = changelog_from_git_commits(merge_commit_filtering: "exclude_merges")
github_release = set_github_release(
repository_name: "daltoniam/Starscream",
api_token: github_token,
repository_name: "daltoniam/starscream",
api_token: ENV["GITHUB_TOKEN"],
name: version,
tag_name: version,
description: changelog,
commitish: "master"
)
sh("git fetch --tags")
pod_push(allow_warnings: true, verbose: true)
pod_push(allow_warnings: false, verbose: true)
end
end
+29 -15
View File
@@ -1,29 +1,43 @@
fastlane documentation
================
----
# Installation
Make sure you have the latest version of the Xcode command line tools installed:
```
```sh
xcode-select --install
```
Install _fastlane_ using
```
[sudo] gem install fastlane -NV
```
or alternatively using `brew cask install fastlane`
For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane)
# Available Actions
## iOS
### ios release
### test
```sh
[bundle exec] fastlane test
```
fastlane ios release
```
Depoy new version
Run tests
----
This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run.
More information about fastlane can be found on [fastlane.tools](https://fastlane.tools).
The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
## iOS
### ios release
```sh
[bundle exec] fastlane ios release
```
Deploy new version
----
This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run.
More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools).
The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools).
-4
View File
@@ -1,4 +0,0 @@
#!/bin/bash
bundle install
bundle exec fastlane release