Updated script that can be controled by Nodejs web app

This commit is contained in:
mac OS
2024-11-25 12:24:18 +07:00
parent c440eda1f4
commit 8b0ab2bd3a
8662 changed files with 1803808 additions and 34 deletions

View File

@ -0,0 +1 @@
pip

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2017 Benno Rice and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,177 @@
Metadata-Version: 2.1
Name: wsproto
Version: 1.2.0
Summary: WebSockets state-machine based protocol implementation
Home-page: https://github.com/python-hyper/wsproto/
Author: Benno Rice
Author-email: benno@jeamland.net
License: MIT License
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.7.0
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: h11 (<1,>=0.9.0)
========================================================
Pure Python, pure state-machine WebSocket implementation
========================================================
.. image:: https://github.com/python-hyper/wsproto/workflows/CI/badge.svg
:target: https://github.com/python-hyper/wsproto/actions
:alt: Build Status
.. image:: https://codecov.io/gh/python-hyper/wsproto/branch/main/graph/badge.svg
:target: https://codecov.io/gh/python-hyper/wsproto
:alt: Code Coverage
.. image:: https://readthedocs.org/projects/wsproto/badge/?version=latest
:target: https://wsproto.readthedocs.io/en/latest/
:alt: Documentation Status
.. image:: https://img.shields.io/badge/chat-join_now-brightgreen.svg
:target: https://gitter.im/python-hyper/community
:alt: Chat community
This repository contains a pure-Python implementation of a WebSocket protocol
stack. It's written from the ground up to be embeddable in whatever program you
choose to use, ensuring that you can communicate via WebSockets, as defined in
`RFC6455 <https://tools.ietf.org/html/rfc6455>`_, regardless of your programming
paradigm.
This repository does not provide a parsing layer, a network layer, or any rules
about concurrency. Instead, it's a purely in-memory solution, defined in terms
of data actions and WebSocket frames. RFC6455 and Compression Extensions for
WebSocket via `RFC7692 <https://tools.ietf.org/html/rfc7692>`_ are fully
supported.
wsproto supports Python 3.6.1 or higher.
To install it, just run:
.. code-block:: console
$ pip install wsproto
Usage
=====
Let's assume you have some form of network socket available. wsproto client
connections automatically generate a HTTP request to initiate the WebSocket
handshake. To create a WebSocket client connection:
.. code-block:: python
from wsproto import WSConnection, ConnectionType
from wsproto.events import Request
ws = WSConnection(ConnectionType.CLIENT)
ws.send(Request(host='echo.websocket.org', target='/'))
To create a WebSocket server connection:
.. code-block:: python
from wsproto.connection import WSConnection, ConnectionType
ws = WSConnection(ConnectionType.SERVER)
Every time you send a message, or call a ping, or simply if you receive incoming
data, wsproto might respond with some outgoing data that you have to send:
.. code-block:: python
some_socket.send(ws.bytes_to_send())
Both connection types need to receive incoming data:
.. code-block:: python
ws.receive_data(some_byte_string_of_data)
And wsproto will issue events if the data contains any WebSocket messages or state changes:
.. code-block:: python
for event in ws.events():
if isinstance(event, Request):
# only client connections get this event
ws.send(AcceptConnection())
elif isinstance(event, CloseConnection):
# guess nobody wants to talk to us any more...
elif isinstance(event, TextMessage):
print('We got text!', event.data)
elif isinstance(event, BytesMessage):
print('We got bytes!', event.data)
Take a look at our docs for a `full list of events
<https://wsproto.readthedocs.io/en/latest/api.html#events>`!
Testing
=======
It passes the autobahn test suite completely and strictly in both client and
server modes and using permessage-deflate.
If you want to run the compliance tests, go into the compliance directory and
then to test client mode, in one shell run the Autobahn test server:
.. code-block:: console
$ wstest -m fuzzingserver -s ws-fuzzingserver.json
And in another shell run the test client:
.. code-block:: console
$ python test_client.py
And to test server mode, run the test server:
.. code-block:: console
$ python test_server.py
And in another shell run the Autobahn test client:
.. code-block:: console
$ wstest -m fuzzingclient -s ws-fuzzingclient.json
Documentation
=============
Documentation is available at https://wsproto.readthedocs.io/en/latest/.
Contributing
============
``wsproto`` welcomes contributions from anyone! Unlike many other projects we
are happy to accept cosmetic contributions and small contributions, in addition
to large feature requests and changes.
Before you contribute (either by opening an issue or filing a pull request),
please `read the contribution guidelines`_.
.. _read the contribution guidelines: http://python-hyper.org/en/latest/contributing.html
License
=======
``wsproto`` is made available under the MIT License. For more details, see the
``LICENSE`` file in the repository.
Authors
=======
``wsproto`` was created by @jeamland, and is maintained by the python-hyper
community.

View File

@ -0,0 +1,23 @@
wsproto-1.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
wsproto-1.2.0.dist-info/LICENSE,sha256=wDKajb80N7CV9_XPQlfWu4VeBxIMroeGWGBz_3ppmVk,1093
wsproto-1.2.0.dist-info/METADATA,sha256=V7EI9a-gXS3NLxeYYmWqtf_MkMfepGoTF03IaR-OVwo,5607
wsproto-1.2.0.dist-info/RECORD,,
wsproto-1.2.0.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
wsproto-1.2.0.dist-info/top_level.txt,sha256=BUdIrwL11zET0fkWkYRJ1yZKrEfvDF9DZqjhABOio6Y,8
wsproto/__init__.py,sha256=zQSIjLjveTHwyhGAfqG_n_cVl54hTkeV6vuad1cnEOE,2887
wsproto/__pycache__/__init__.cpython-313.pyc,,
wsproto/__pycache__/connection.cpython-313.pyc,,
wsproto/__pycache__/events.cpython-313.pyc,,
wsproto/__pycache__/extensions.cpython-313.pyc,,
wsproto/__pycache__/frame_protocol.cpython-313.pyc,,
wsproto/__pycache__/handshake.cpython-313.pyc,,
wsproto/__pycache__/typing.cpython-313.pyc,,
wsproto/__pycache__/utilities.cpython-313.pyc,,
wsproto/connection.py,sha256=LhsbokxZUmAtMsOFFZ45puZDPyIXNEmq7SanE7swAgE,6813
wsproto/events.py,sha256=DW7YQ823oK3MjXHqcPvjJzjBGk5UGuMO_rpNnKgmmW8,7979
wsproto/extensions.py,sha256=VlnojvsC2AO7vbUkw_TOqCgtmHb1dSplXeRwjMfjCo4,11211
wsproto/frame_protocol.py,sha256=B5p_wRq54gvTihegbJ39RkONrdhtipoYDEiYq95BdAk,23401
wsproto/handshake.py,sha256=hPqTo15MqOxYlvcNYTo-bIzQJHtRLq8qq2jBdHdz2x8,18036
wsproto/py.typed,sha256=sow9soTwP9T_gEAQSVh7Gb8855h04Nwmhs2We-JRgZM,7
wsproto/typing.py,sha256=Ryf6eOhAzfZlHCFELiiayDzNqdXQG7JKccblOqNx6Wo,68
wsproto/utilities.py,sha256=5qmPXSUhUp2GESgvgIacZ7N4uqd0vBijhVV7t6XTiZw,2816

View File

@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.37.0)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@ -0,0 +1 @@
wsproto