Skip to content

Commit 104feb9

Browse files
Merge pull request #105 from ayushsharma82/dev
v2.0.8
2 parents c3563a5 + 8b5d84a commit 104feb9

File tree

9 files changed

+282
-13
lines changed

9 files changed

+282
-13
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@ jobs:
6060
run: arduino-cli core install --additional-urls "${{ matrix.index_url }}" ${{ matrix.core }}
6161

6262
- name: Install AsyncTCP
63-
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/AsyncTCP#v3.2.5
63+
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/AsyncTCP#v3.2.6
6464

6565
- name: Install ESPAsyncTCP
6666
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/esphome-ESPAsyncTCP#v2.0.0
6767

6868
- name: Install ESPAsyncWebServer
69-
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/ESPAsyncWebServer#v3.2.4
69+
run: ARDUINO_LIBRARY_ENABLE_UNSAFE_INSTALL=true arduino-cli lib install --git-url https://github.com/mathieucarbou/ESPAsyncWebServer#v3.3.17
7070

7171
- name: Build Demo
7272
run: arduino-cli compile --library . --warnings none -b ${{ matrix.board }} "examples/Demo/Demo.ino"

.github/workflows/cla.yml

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: "CLA Assistant"
2+
on:
3+
issue_comment:
4+
types: [created]
5+
pull_request_target:
6+
types: [opened,closed,synchronize]
7+
8+
# explicitly configure permissions, in case your GITHUB_TOKEN workflow permissions are set to read-only in repository settings
9+
permissions:
10+
actions: write
11+
contents: write # this can be 'read' if the signatures are in remote repository
12+
pull-requests: write
13+
statuses: write
14+
15+
jobs:
16+
CLAAssistant:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: "CLA Assistant"
20+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
21+
uses: contributor-assistant/[email protected]
22+
env:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
with:
25+
path-to-signatures: '.github/cla-signatures/cla.json'
26+
path-to-document: 'https://github.com/ayushsharma82/WebSerial/blob/master/CLA.md' # e.g. a CLA or a DCO document
27+
# branch should not be protected
28+
branch: 'dev'
29+
allowlist: ayushsharma82,bot*

CLA.md

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Contributor Agreement
2+
3+
## Individual Contributor Non-Exclusive License Agreement
4+
5+
Thank you for your interest in contributing to Softt's Software ("We" or "Us").
6+
7+
The purpose of this contributor agreement ("Agreement") is to clarify and document the rights granted by contributors to Us.
8+
9+
### How to use this Contributor Agreement
10+
11+
If You are an employee and have created the Contribution as part of your employment, You need to have Your employer approve this Agreement or sign the Entity version of this document. If You do not own the Copyright in the entire work of authorship, any other author of the Contribution should also sign this – in any event, please contact Us at <[email protected]>
12+
13+
### 1\. Definitions
14+
15+
**"You"** means the individual Copyright owner who Submits a Contribution to Us.
16+
17+
**"Legal Entity"** means an entity that is not a natural person.
18+
19+
**"Affiliate"** means any other Legal Entity that controls, is controlled by, or under common control with that Legal Entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such Legal Entity, whether by contract or otherwise, (ii) ownership of fifty percent (50%) or more of the outstanding shares or securities that vote to elect the management or other persons who direct such Legal Entity or (iii) beneficial ownership of such entity.
20+
21+
**"Contribution"** means any original work of authorship, including any original modifications or additions to an existing work of authorship, Submitted by You to Us, in which You own the Copyright.
22+
23+
**"Copyright"** means all rights protecting works of authorship, including copyright, moral and neighboring rights, as appropriate, for the full term of their existence.
24+
25+
**"Material"** means the software or documentation made available by Us to third parties. When this Agreement covers more than one software project, the Material means the software or documentation to which the Contribution was Submitted. After You Submit the Contribution, it may be included in the Material.
26+
27+
**"Submit"** means any act by which a Contribution is transferred to Us by You by means of tangible or intangible media, including but not limited to electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Us, but excluding any transfer that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
28+
29+
**"Documentation"** means any non-software portion of a Contribution.
30+
31+
### 2\. License grant
32+
33+
#### 2.1 Copyright license to Us
34+
35+
Subject to the terms and conditions of this Agreement, You hereby grant to Us a worldwide, royalty-free, NON-exclusive, perpetual and irrevocable (except as stated in Section 8.2) license, with the right to transfer an unlimited number of non-exclusive licenses or to grant sublicenses to third parties, under the Copyright covering the Contribution to use the Contribution by all means, including, but not limited to:
36+
37+
* publish the Contribution,
38+
* modify the Contribution,
39+
* prepare derivative works based upon or containing the Contribution and/or to combine the Contribution with other Materials,
40+
* reproduce the Contribution in original or modified form,
41+
* distribute, to make the Contribution available to the public, display and publicly perform the Contribution in original or modified form.
42+
43+
#### 2.2 Moral rights
44+
45+
Moral Rights remain unaffected to the extent they are recognized and not waivable by applicable law. Notwithstanding, You may add your name to the attribution mechanism customary used in the Materials you Contribute to, such as the header of the source code files of Your Contribution, and We will respect this attribution when using Your Contribution.
46+
47+
### 3\. Patents
48+
49+
#### 3.1 Patent license
50+
51+
Subject to the terms and conditions of this Agreement You hereby grant to Us and to recipients of Materials distributed by Us a worldwide, royalty-free, non-exclusive, perpetual and irrevocable (except as stated in Section 3.2) patent license, with the right to transfer an unlimited number of non-exclusive licenses or to grant sublicenses to third parties, to make, have made, use, sell, offer for sale, import and otherwise transfer the Contribution and the Contribution in combination with any Material (and portions of such combination). This license applies to all patents owned or controlled by You, whether already acquired or hereafter acquired, that would be infringed by making, having made, using, selling, offering for sale, importing or otherwise transferring of Your Contribution(s) alone or by combination of Your Contribution(s) with any Material.
52+
53+
#### 3.2 Revocation of patent license
54+
55+
You reserve the right to revoke the patent license stated in section 3.1 if We make any infringement claim that is targeted at your Contribution and not asserted for a Defensive Purpose. An assertion of claims of the Patents shall be considered for a "Defensive Purpose" if the claims are asserted against an entity that has filed, maintained, threatened, or voluntarily participated in a patent infringement lawsuit against Us or any of Our licensees.
56+
57+
### 4. Disclaimer
58+
59+
THE CONTRIBUTION IS PROVIDED "AS IS". MORE PARTICULARLY, ALL EXPRESS OR IMPLIED WARRANTIES INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTY OF SATISFACTORY QUALITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE EXPRESSLY DISCLAIMED BY YOU TO US AND BY US TO YOU. TO THE EXTENT THAT ANY SUCH WARRANTIES CANNOT BE DISCLAIMED, SUCH WARRANTY IS LIMITED IN DURATION AND EXTENT TO THE MINIMUM PERIOD AND EXTENT PERMITTED BY LAW.
60+
61+
### 5. Consequential damage waiver
62+
63+
TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, IN NO EVENT WILL YOU OR WE BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF ANTICIPATED SAVINGS, LOSS OF DATA, INDIRECT, SPECIAL, INCIDENTAL, CONSEQUENTIAL AND EXEMPLARY DAMAGES ARISING OUT OF THIS AGREEMENT REGARDLESS OF THE LEGAL OR EQUITABLE THEORY (CONTRACT, TORT OR OTHERWISE) UPON WHICH THE CLAIM IS BASED.
64+
65+
### 6. Approximation of disclaimer and damage waiver
66+
67+
IF THE DISCLAIMER AND DAMAGE WAIVER MENTIONED IN SECTION 4. AND SECTION 5. CANNOT BE GIVEN LEGAL EFFECT UNDER APPLICABLE LOCAL LAW, REVIEWING COURTS SHALL APPLY LOCAL LAW THAT MOST CLOSELY APPROXIMATES AN ABSOLUTE WAIVER OF ALL CIVIL OR CONTRACTUAL LIABILITY IN CONNECTION WITH THE CONTRIBUTION.
68+
69+
### 7. Term
70+
71+
7.1 This Agreement shall come into effect upon Your acceptance of the terms and conditions.
72+
73+
7.3 In the event of a termination of this Agreement Sections 4, 5, 6, 7 and 8 shall survive such termination and shall remain in full force thereafter. For the avoidance of doubt, Free and Open Source Software (sub)licenses that have already been granted for Contributions at the date of the termination shall remain in full force after the termination of this Agreement.
74+
75+
### 8 Miscellaneous
76+
77+
8.1 This Agreement and all disputes, claims, actions, suits or other proceedings arising out of this agreement or relating in any way to it shall be governed by the laws of India excluding its private international law provisions.
78+
79+
8.2 This Agreement sets out the entire agreement between You and Us for Your Contributions to Us and overrides all other agreements or understandings.
80+
81+
8.3 In case of Your death, this agreement shall continue with Your heirs. In case of more than one heir, all heirs must exercise their rights through a commonly authorized person.
82+
83+
8.4 If any provision of this Agreement is found void and unenforceable, such provision will be replaced to the extent possible with a provision that comes closest to the meaning of the original provision and that is enforceable. The terms and conditions set forth in this Agreement shall apply notwithstanding any failure of essential purpose of this Agreement or any limited remedy to the maximum extent possible under law.
84+
85+
8.5 You agree to notify Us of any facts or circumstances of which you become aware that would make this Agreement inaccurate in any respect.

CODE_OF_CONDUCT.md

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
2+
# Contributor Covenant Code of Conduct
3+
4+
## Our Pledge
5+
6+
We as members, contributors, and leaders pledge to make participation in our
7+
community a harassment-free experience for everyone, regardless of age, body
8+
size, visible or invisible disability, ethnicity, sex characteristics, gender
9+
identity and expression, level of experience, education, socio-economic status,
10+
nationality, personal appearance, race, religion, or sexual identity
11+
and orientation.
12+
13+
We pledge to act and interact in ways that contribute to an open, welcoming,
14+
diverse, inclusive, and healthy community.
15+
16+
## Our Standards
17+
18+
Examples of behavior that contributes to a positive environment for our
19+
community include:
20+
21+
* Demonstrating empathy and kindness toward other people
22+
* Being respectful of differing opinions, viewpoints, and experiences
23+
* Giving and gracefully accepting constructive feedback
24+
* Accepting responsibility and apologizing to those affected by our mistakes,
25+
and learning from the experience
26+
* Focusing on what is best not just for us as individuals, but for the
27+
overall community
28+
29+
Examples of unacceptable behavior include:
30+
31+
* The use of sexualized language or imagery, and sexual attention or
32+
advances of any kind
33+
* Trolling, insulting or derogatory comments, and personal or political attacks
34+
* Public or private harassment
35+
* Publishing others' private information, such as a physical or email
36+
address, without their explicit permission
37+
* Other conduct which could reasonably be considered inappropriate in a
38+
professional setting
39+
40+
## Enforcement Responsibilities
41+
42+
Community leaders are responsible for clarifying and enforcing our standards of
43+
acceptable behavior and will take appropriate and fair corrective action in
44+
response to any behavior that they deem inappropriate, threatening, offensive,
45+
or harmful.
46+
47+
Community leaders have the right and responsibility to remove, edit, or reject
48+
comments, commits, code, wiki edits, issues, and other contributions that are
49+
not aligned to this Code of Conduct, and will communicate reasons for moderation
50+
decisions when appropriate.
51+
52+
## Scope
53+
54+
This Code of Conduct applies within all community spaces, and also applies when
55+
an individual is officially representing the community in public spaces.
56+
Examples of representing our community include using an official e-mail address,
57+
posting via an official social media account, or acting as an appointed
58+
representative at an online or offline event.
59+
60+
## Enforcement
61+
62+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
63+
reported to the community leaders responsible for enforcement at
64+
65+
All complaints will be reviewed and investigated promptly and fairly.
66+
67+
All community leaders are obligated to respect the privacy and security of the
68+
reporter of any incident.
69+
70+
## Enforcement Guidelines
71+
72+
Community leaders will follow these Community Impact Guidelines in determining
73+
the consequences for any action they deem in violation of this Code of Conduct:
74+
75+
### 1. Correction
76+
77+
**Community Impact**: Use of inappropriate language or other behavior deemed
78+
unprofessional or unwelcome in the community.
79+
80+
**Consequence**: A private, written warning from community leaders, providing
81+
clarity around the nature of the violation and an explanation of why the
82+
behavior was inappropriate. A public apology may be requested.
83+
84+
### 2. Warning
85+
86+
**Community Impact**: A violation through a single incident or series
87+
of actions.
88+
89+
**Consequence**: A warning with consequences for continued behavior. No
90+
interaction with the people involved, including unsolicited interaction with
91+
those enforcing the Code of Conduct, for a specified period of time. This
92+
includes avoiding interactions in community spaces as well as external channels
93+
like social media. Violating these terms may lead to a temporary or
94+
permanent ban.
95+
96+
### 3. Temporary Ban
97+
98+
**Community Impact**: A serious violation of community standards, including
99+
sustained inappropriate behavior.
100+
101+
**Consequence**: A temporary ban from any sort of interaction or public
102+
communication with the community for a specified period of time. No public or
103+
private interaction with the people involved, including unsolicited interaction
104+
with those enforcing the Code of Conduct, is allowed during this period.
105+
Violating these terms may lead to a permanent ban.
106+
107+
### 4. Permanent Ban
108+
109+
**Community Impact**: Demonstrating a pattern of violation of community
110+
standards, including sustained inappropriate behavior, harassment of an
111+
individual, or aggression toward or disparagement of classes of individuals.
112+
113+
**Consequence**: A permanent ban from any sort of public interaction within
114+
the community.
115+
116+
## Attribution
117+
118+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
119+
version 2.0, available at
120+
<https://www.contributor-covenant.org/version/2/0/code_of_conduct.html>.
121+
122+
Community Impact Guidelines were inspired by [Mozilla's code of conduct
123+
enforcement ladder](https://github.com/mozilla/diversity).
124+
125+
[homepage]: https://www.contributor-covenant.org
126+
127+
For answers to common questions about this code of conduct, see the FAQ at
128+
<https://www.contributor-covenant.org/faq>. Translations are available at
129+
<https://www.contributor-covenant.org/translations>.

examples/HighPerf/HighPerf.ino

+10
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ void loop() {
5656
if (millis() - last > 50) {
5757
#endif
5858
count++;
59+
5960
long r = random(10, 250) + 15;
6061
String buffer;
6162
buffer.reserve(r);
@@ -67,7 +68,16 @@ void loop() {
6768
for (int i = 0; i < r; i++) {
6869
buffer += dict[random(0, 62)];
6970
}
71+
72+
#ifdef WSL_HIGH_PERF
73+
// Using internal websocket buffer to improve memory consumption and avoid another internal copy when enqueueing the message
74+
AsyncWebSocketMessageBuffer* wsBuffer = WebSerial.makeBuffer(buffer.length());
75+
memmove(wsBuffer->get(), buffer.c_str(), buffer.length());
76+
WebSerial.send(wsBuffer);
77+
#else
7078
WebSerial.print(buffer);
79+
#endif
80+
7181
last = millis();
7282
}
7383
}

library.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
"maintainer": true
1616
}
1717
],
18-
"version": "2.0.7",
18+
"version": "2.0.8",
1919
"frameworks": "arduino",
2020
"platforms": ["espressif8266", "espressif32"],
2121
"dependencies": [
2222
{
2323
"owner": "mathieucarbou",
2424
"name": "ESPAsyncWebServer",
25-
"version": "^3.2.4",
25+
"version": "^3.3.17",
2626
"platforms": ["espressif8266", "espressif32"]
2727
}
2828
]

library.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=WebSerial
2-
version=2.0.7
2+
version=2.0.8
33
author=Ayush Sharma
44
category=Communication
55
maintainer=Ayush Sharma <[email protected]>

platformio.ini

+1-8
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ build_flags =
99
-D WS_MAX_QUEUED_MESSAGES=128
1010
-D WSL_HIGH_PERF
1111
lib_deps =
12-
mathieucarbou/AsyncTCP@^3.2.5
13-
mathieucarbou/ESPAsyncWebServer@^3.2.4
12+
mathieucarbou/ESPAsyncWebServer@^3.3.11
1413
lib_compat_mode = strict
1514
lib_ldf_mode = chain
1615
upload_protocol = esptool
@@ -43,9 +42,6 @@ board = esp32-s3-devkitc-1
4342
platform = espressif8266
4443
board = huzzah
4544
; board = d1_mini
46-
lib_deps =
47-
mathieucarbou/ESPAsyncWebServer@^3.2.4
48-
esphome/ESPAsyncTCP-esphome@^2.0.0
4945

5046
; CI
5147

@@ -64,6 +60,3 @@ board = ${sysenv.PIO_BOARD}
6460
[env:ci-esp8266]
6561
platform = espressif8266
6662
board = ${sysenv.PIO_BOARD}
67-
lib_deps =
68-
mathieucarbou/ESPAsyncWebServer@^3.2.4
69-
esphome/ESPAsyncTCP-esphome@^2.0.0

src/WebSerial.h

+23
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,29 @@ class WebSerialClass : public Print {
114114
// The buffer is not enabled by default.
115115
void setBuffer(size_t initialCapacity);
116116

117+
#ifdef WSL_HIGH_PERF
118+
#ifdef ASYNCWEBSERVER_FORK_mathieucarbou
119+
// Expose the internal WebSocket makeBuffer to even improve memory consumption on client-side
120+
// 1. make a AsyncWebSocketMessageBuffer
121+
// 2. put the data inside
122+
// 3. send the buffer
123+
// This method avoids a buffer copy when creating the WebSocket message
124+
AsyncWebSocketMessageBuffer* makeBuffer(size_t size = 0) {
125+
if (!_ws)
126+
return nullptr;
127+
return _ws->makeBuffer(size);
128+
}
129+
130+
void send(AsyncWebSocketMessageBuffer* buffer) {
131+
if (!_ws || !buffer)
132+
return;
133+
_ws->cleanupClients(WSL_MAX_WS_CLIENTS);
134+
if (_ws->count())
135+
_ws->textAll(buffer);
136+
}
137+
#endif
138+
#endif
139+
117140
private:
118141
// Server
119142
AsyncWebServer *_server;

0 commit comments

Comments
 (0)