Skip to content

Commit f162565

Browse files
committed
feat: initial commit
0 parents  commit f162565

File tree

96 files changed

+19596
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+19596
-0
lines changed

.eslintrc.js

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
module.exports = {
2+
env: {
3+
es6: true,
4+
node: true,
5+
},
6+
plugins: ['import', 'simple-import-sort'],
7+
extends: ['eslint:recommended'],
8+
parserOptions: {
9+
ecmaVersion: 2020,
10+
sourceType: 'module',
11+
},
12+
rules: {
13+
'prettier/prettier': [
14+
'error',
15+
{
16+
trailingComma: 'es5',
17+
semi: false,
18+
singleQuote: true,
19+
arrowParens: 'always',
20+
printWidth: 100,
21+
},
22+
],
23+
'object-shorthand': ['error', 'always'],
24+
'simple-import-sort/imports': 'error',
25+
'simple-import-sort/exports': 'error',
26+
},
27+
overrides: [
28+
{
29+
files: ['*.ts', '*.tsx'],
30+
parser: '@typescript-eslint/parser',
31+
plugins: ['@typescript-eslint/eslint-plugin'],
32+
extends: ['plugin:@typescript-eslint/recommended', 'plugin:import/typescript'],
33+
settings: {
34+
'import/parsers': {
35+
'@typescript-eslint/parser': ['.ts', '.tsx'],
36+
},
37+
'import/resolver': {
38+
typescript: {
39+
alwaysTryTypes: true,
40+
},
41+
},
42+
},
43+
rules: {
44+
'@typescript-eslint/no-explicit-any': 'off',
45+
'@typescript-eslint/ban-types': 'off',
46+
'@typescript-eslint/ban-ts-comment': 'off',
47+
'@typescript-eslint/ban-ts-ignore': 'off',
48+
'@typescript-eslint/explicit-module-boundary-types': 'off',
49+
'@typescript-eslint/explicit-function-return-type': 'off',
50+
},
51+
},
52+
{
53+
files: ['*'],
54+
plugins: ['prettier'],
55+
extends: ['plugin:prettier/recommended'],
56+
},
57+
],
58+
}

.gitignore

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# OSX
2+
#
3+
.DS_Store
4+
5+
# Ruby
6+
vendor/
7+
.bundle
8+
9+
# Xcode
10+
#
11+
build/
12+
*.pbxuser
13+
!default.pbxuser
14+
*.mode1v3
15+
!default.mode1v3
16+
*.mode2v3
17+
!default.mode2v3
18+
*.perspectivev3
19+
!default.perspectivev3
20+
xcuserdata
21+
*.xccheckout
22+
*.moved-aside
23+
DerivedData
24+
*.hmap
25+
*.ipa
26+
*.xcuserstate
27+
**/.xcode.env.local
28+
29+
# Android/IntelliJ
30+
#
31+
build/
32+
.idea
33+
.gradle
34+
local.properties
35+
*.iml
36+
*.hprof
37+
.cxx/
38+
*.keystore
39+
!debug.keystore
40+
41+
# node.js
42+
#
43+
node_modules/
44+
npm-debug.log
45+
yarn-error.log
46+
47+
# fastlane
48+
#
49+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
50+
# screenshots whenever they are needed.
51+
# For more information about the recommended setup visit:
52+
# https://docs.fastlane.tools/best-practices/source-control/
53+
54+
**/fastlane/report.xml
55+
**/fastlane/Preview.html
56+
**/fastlane/screenshots
57+
**/fastlane/test_output
58+
59+
# Bundle artifact
60+
*.jsbundle
61+
62+
# Ruby / CocoaPods
63+
**/Pods/
64+
/vendor/bundle/
65+
66+
# Temporary files created by Metro to check the health of the file watcher
67+
.metro-health-check*
68+
69+
# testing
70+
/coverage
71+
72+
# Yarn
73+
.yarn/*
74+
!.yarn/patches
75+
!.yarn/plugins
76+
!.yarn/releases
77+
!.yarn/sdks
78+
!.yarn/versions

.vscode/settings.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib",
3+
"typescript.enablePromptUseWorkspaceTsdk": true,
4+
"editor.formatOnSave": false,
5+
"editor.codeActionsOnSave": {
6+
"source.fixAll.eslint": "always"
7+
}
8+
}

Gemfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
source 'https://rubygems.org'
2+
3+
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4+
ruby ">= 2.6.10"
5+
6+
# Exclude problematic versions of cocoapods and activesupport that causes build failures.
7+
gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8+
gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'

Gemfile.lock

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
GEM
2+
remote: https://rubygems.org/
3+
specs:
4+
CFPropertyList (3.0.7)
5+
base64
6+
nkf
7+
rexml
8+
activesupport (6.1.7.8)
9+
concurrent-ruby (~> 1.0, >= 1.0.2)
10+
i18n (>= 1.6, < 2)
11+
minitest (>= 5.1)
12+
tzinfo (~> 2.0)
13+
zeitwerk (~> 2.3)
14+
addressable (2.8.7)
15+
public_suffix (>= 2.0.2, < 7.0)
16+
algoliasearch (1.27.5)
17+
httpclient (~> 2.8, >= 2.8.3)
18+
json (>= 1.5.1)
19+
atomos (0.1.3)
20+
base64 (0.2.0)
21+
claide (1.1.0)
22+
cocoapods (1.15.2)
23+
addressable (~> 2.8)
24+
claide (>= 1.0.2, < 2.0)
25+
cocoapods-core (= 1.15.2)
26+
cocoapods-deintegrate (>= 1.0.3, < 2.0)
27+
cocoapods-downloader (>= 2.1, < 3.0)
28+
cocoapods-plugins (>= 1.0.0, < 2.0)
29+
cocoapods-search (>= 1.0.0, < 2.0)
30+
cocoapods-trunk (>= 1.6.0, < 2.0)
31+
cocoapods-try (>= 1.1.0, < 2.0)
32+
colored2 (~> 3.1)
33+
escape (~> 0.0.4)
34+
fourflusher (>= 2.3.0, < 3.0)
35+
gh_inspector (~> 1.0)
36+
molinillo (~> 0.8.0)
37+
nap (~> 1.0)
38+
ruby-macho (>= 2.3.0, < 3.0)
39+
xcodeproj (>= 1.23.0, < 2.0)
40+
cocoapods-core (1.15.2)
41+
activesupport (>= 5.0, < 8)
42+
addressable (~> 2.8)
43+
algoliasearch (~> 1.0)
44+
concurrent-ruby (~> 1.1)
45+
fuzzy_match (~> 2.0.4)
46+
nap (~> 1.0)
47+
netrc (~> 0.11)
48+
public_suffix (~> 4.0)
49+
typhoeus (~> 1.0)
50+
cocoapods-deintegrate (1.0.5)
51+
cocoapods-downloader (2.1)
52+
cocoapods-plugins (1.0.0)
53+
nap
54+
cocoapods-search (1.0.1)
55+
cocoapods-trunk (1.6.0)
56+
nap (>= 0.8, < 2.0)
57+
netrc (~> 0.11)
58+
cocoapods-try (1.2.0)
59+
colored2 (3.1.2)
60+
concurrent-ruby (1.3.4)
61+
escape (0.0.4)
62+
ethon (0.16.0)
63+
ffi (>= 1.15.0)
64+
ffi (1.17.0)
65+
fourflusher (2.3.1)
66+
fuzzy_match (2.0.4)
67+
gh_inspector (1.1.3)
68+
httpclient (2.8.3)
69+
i18n (1.14.5)
70+
concurrent-ruby (~> 1.0)
71+
json (2.7.2)
72+
minitest (5.25.1)
73+
molinillo (0.8.0)
74+
nanaimo (0.3.0)
75+
nap (1.1.0)
76+
netrc (0.11.0)
77+
nkf (0.2.0)
78+
public_suffix (4.0.7)
79+
rexml (3.3.7)
80+
ruby-macho (2.5.1)
81+
typhoeus (1.4.1)
82+
ethon (>= 0.9.0)
83+
tzinfo (2.0.6)
84+
concurrent-ruby (~> 1.0)
85+
xcodeproj (1.25.0)
86+
CFPropertyList (>= 2.3.3, < 4.0)
87+
atomos (~> 0.1.3)
88+
claide (>= 1.0.2, < 2.0)
89+
colored2 (~> 3.1)
90+
nanaimo (~> 0.3.0)
91+
rexml (>= 3.3.2, < 4.0)
92+
zeitwerk (2.6.18)
93+
94+
PLATFORMS
95+
ruby
96+
97+
DEPENDENCIES
98+
activesupport (>= 6.1.7.5, != 7.1.0)
99+
cocoapods (>= 1.13, != 1.15.1, != 1.15.0)
100+
101+
RUBY VERSION
102+
ruby 2.6.10p210
103+
104+
BUNDLED WITH
105+
1.17.2

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
`react-native-fast-ws`
2+
======
3+
4+
Blazing fast WebSocket client for React Native built on top of [Nitro](https://mrousavy.github.io/nitro).
5+
6+
> [!WARNING]
7+
> This library is still under development. Use at your own risk. The API is experimental and subject to change. This project explores new ideas and approaches to WebSocket and Blob APIs, thanks to Nitro, and its scope may change.
8+
9+
### Getting started
10+
11+
```
12+
npm install react-native-fast-ws react-native-nitro-modules
13+
```
14+
15+
### TODOs
16+
17+
- Provide Android support
18+
- Upgrade dependencies to latest (yeah, I've been working on this for waaaay to long)
19+
- Fix outstanding (and known) issues
20+
- Figure out a better name and logo
21+
- Stable release at [React Native London Conf](https://www.reactnativelondon.co.uk)
22+
- Extract Blob to a separate package
23+
- Documentation
24+
25+
If you want to contribute, please reach out (you can find me on [X/Twitter](https://x.com/grabbou)).
26+
27+
### Differences with React Native
28+
29+
**Blob**
30+
- Fully [W3C compliant](https://w3c.github.io/FileAPI/#blob-section)
31+
- Can create `Blob` from `ArrayBuffer`, `ArrayBufferView`, `Blob`, or `string`. With React Native, [you can only create Blob from string or another Blob](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Blob/BlobManager.js#L69-L73)
32+
- Has `text()`, `arrayBuffer()`, and `stream()` methods. With React Native, you can only access the contents of `Blob` via [custom `data` field](https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Blob/Blob.js#L75-L82)
33+
- Does not depend on a native module. Uses `ArrayBuffer`s natively, thanks to Nitro Modules. With React Native, [Blob uses `RCTBlobManager` under the hood](https://github.com/facebook/react-native/blob/bd323929dc5be5666ee36043babec7d981a095dc/packages/react-native/Libraries/Blob/RCTBlobManager.h#L15) to create and hold references to the data
34+
- Automatically deallocated when no longer in use. [You don't have to `close()` it manually](https://github.com/facebook/react-native/blob/bd323929dc5be5666ee36043babec7d981a095dc/packages/react-native/Libraries/Blob/Blob.js#L122-L138)
35+
36+
**Websockets**
37+
- On iOS, uses built-in APIs for WebSockets (available on iOS 13+). React Native uses `SocketRocket` instead
38+
- Does not use `EventEmitter` to communicate new messages back to the JavaScript. With Nitro, we can call callbacks directly

0 commit comments

Comments
 (0)