main 9cf6b725ab46 cached
144 files
1.2 MB
327.0k tokens
840 symbols
1 requests
Download .txt
Showing preview only (1,307K chars total). Download the full file or copy to clipboard to get everything.
Repository: miguelgrinberg/python-engineio
Branch: main
Commit: 9cf6b725ab46
Files: 144
Total size: 1.2 MB

Directory structure:
gitextract_syw1c215/

├── .gitattributes
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   ├── config.yml
│   │   └── feature_request.md
│   └── workflows/
│       └── tests.yml
├── .gitignore
├── .readthedocs.yaml
├── CHANGES.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── SECURITY.md
├── docs/
│   ├── Makefile
│   ├── _static/
│   │   └── README.md
│   ├── api.rst
│   ├── api_asgiapp.rst
│   ├── api_async_client.rst
│   ├── api_async_server.rst
│   ├── api_client.rst
│   ├── api_middleware.rst
│   ├── api_server.rst
│   ├── api_wsgiapp.rst
│   ├── client.rst
│   ├── conf.py
│   ├── index.rst
│   ├── intro.rst
│   ├── make.bat
│   └── server.rst
├── examples/
│   ├── README.rst
│   ├── client/
│   │   ├── README.rst
│   │   ├── asyncio/
│   │   │   ├── README.rst
│   │   │   ├── latency_client.py
│   │   │   └── simple_client.py
│   │   ├── javascript/
│   │   │   ├── README.md
│   │   │   ├── latency_client.js
│   │   │   └── package.json
│   │   └── threads/
│   │       ├── README.rst
│   │       ├── latency_client.py
│   │       └── simple_client.py
│   └── server/
│       ├── README.rst
│       ├── aiohttp/
│       │   ├── README.rst
│       │   ├── latency.html
│       │   ├── latency.py
│       │   ├── requirements.txt
│       │   ├── simple.html
│       │   ├── simple.py
│       │   └── static/
│       │       ├── engine.io.js
│       │       └── style.css
│       ├── asgi/
│       │   ├── README.rst
│       │   ├── latency.html
│       │   ├── latency.py
│       │   ├── requirements.txt
│       │   ├── simple.html
│       │   ├── simple.py
│       │   └── static/
│       │       ├── engine.io.js
│       │       └── style.css
│       ├── javascript/
│       │   ├── README.md
│       │   ├── index.html
│       │   ├── index.js
│       │   ├── package.json
│       │   └── public/
│       │       ├── index.js
│       │       └── style.css
│       ├── sanic/
│       │   ├── README.rst
│       │   ├── latency.html
│       │   ├── latency.py
│       │   ├── requirements.txt
│       │   ├── simple.html
│       │   ├── simple.py
│       │   └── static/
│       │       ├── engine.io.js
│       │       └── style.css
│       ├── tornado/
│       │   ├── README.rst
│       │   ├── latency.py
│       │   ├── requirements.txt
│       │   ├── simple.py
│       │   ├── static/
│       │   │   ├── engine.io.js
│       │   │   └── style.css
│       │   └── templates/
│       │       ├── latency.html
│       │       └── simple.html
│       └── wsgi/
│           ├── README.rst
│           ├── latency.py
│           ├── requirements.txt
│           ├── simple.py
│           ├── static/
│           │   ├── engine.io.js
│           │   └── style.css
│           └── templates/
│               ├── latency.html
│               └── simple.html
├── pyproject.toml
├── src/
│   └── engineio/
│       ├── __init__.py
│       ├── async_client.py
│       ├── async_drivers/
│       │   ├── __init__.py
│       │   ├── _websocket_wsgi.py
│       │   ├── aiohttp.py
│       │   ├── asgi.py
│       │   ├── eventlet.py
│       │   ├── gevent.py
│       │   ├── gevent_uwsgi.py
│       │   ├── sanic.py
│       │   ├── threading.py
│       │   └── tornado.py
│       ├── async_server.py
│       ├── async_socket.py
│       ├── base_client.py
│       ├── base_server.py
│       ├── base_socket.py
│       ├── client.py
│       ├── exceptions.py
│       ├── json.py
│       ├── middleware.py
│       ├── packet.py
│       ├── payload.py
│       ├── server.py
│       ├── socket.py
│       └── static_files.py
├── tests/
│   ├── __init__.py
│   ├── async/
│   │   ├── __init__.py
│   │   ├── files/
│   │   │   ├── file.txt
│   │   │   └── index.html
│   │   ├── index.html
│   │   ├── test_aiohttp.py
│   │   ├── test_asgi.py
│   │   ├── test_client.py
│   │   ├── test_sanic.py
│   │   ├── test_server.py
│   │   ├── test_socket.py
│   │   └── test_tornado.py
│   ├── common/
│   │   ├── __init__.py
│   │   ├── files/
│   │   │   ├── file.txt
│   │   │   └── index.html
│   │   ├── index.html
│   │   ├── test_client.py
│   │   ├── test_middleware.py
│   │   ├── test_packet.py
│   │   ├── test_payload.py
│   │   ├── test_server.py
│   │   └── test_socket.py
│   └── performance/
│       ├── README.md
│       ├── binary_b64_packet.py
│       ├── binary_packet.py
│       ├── json_packet.py
│       ├── payload.py
│       ├── run.sh
│       ├── server_receive.py
│       └── text_packet.py
└── tox.ini

================================================
FILE CONTENTS
================================================

================================================
FILE: .gitattributes
================================================
example/wsgi/static/engine.io.js linguist-vendored
example/aiohttp/static/engine.io.js linguist-vendored

tests/common/index.html binary
tests/common/files/index.html binary
tests/common/files/file.txt binary
tests/async/index.html binary
tests/async/files/index.html binary
tests/async/files/file.txt binary


================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**IMPORTANT**: If you have a question, or you are not sure if you have found a bug in this package, then you are in the wrong place. Hit back in your web browser, and then open a GitHub Discussion instead. Likewise, if you are unable to provide the information requested below, open a discussion to troubleshoot your issue.

**Describe the bug**
A clear and concise description of what the bug is. If you are getting errors, please include the complete error message, including the stack trace.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Logs**
Please provide relevant logs from the server and the client. On the Python server and client, add the `logger=True` and `engineio_logger=True` arguments to your `Server()` or `Client()` objects to get logs dumped on your terminal. If you are using the JavaScript client, see [here](https://socket.io/docs/v4/logging-and-debugging/) for how to enable logs.

**Additional context**
Add any other context about the problem here.


================================================
FILE: .github/ISSUE_TEMPLATE/config.yml
================================================
blank_issues_enabled: false
contact_links:
  - name: GitHub Discussions
    url: https://github.com/miguelgrinberg/python-engineio/discussions
    about: Ask questions here.


================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Logs**
Please provide relevant logs from the server and the client. On the Python server and client, add the `logger=True` and `engineio_logger=True` arguments to your `Server()` or `Client()` objects to get logs dumped on your terminal. If you are using the JavaScript client, see [here](https://socket.io/docs/v4/logging-and-debugging/) for how to enable logs.

**Additional context**
Add any other context or screenshots about the feature request here.


================================================
FILE: .github/workflows/tests.yml
================================================
name: build
on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main
jobs:
  lint:
    name: lint
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v3
      - run: python -m pip install --upgrade pip wheel
      - run: pip install tox tox-gh-actions
      - run: tox -eflake8
      - run: tox -edocs
  tests:
    name: tests
    strategy:
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
        python: ['3.10', '3.11', '3.12', '3.13', '3.14', 'pypy-3.11']
      fail-fast: false
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v3
        with:
          python-version: ${{ matrix.python }}
      - run: python -m pip install --upgrade pip wheel
      - run: pip install tox tox-gh-actions
      - run: tox
  coverage:
    name: coverage
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: actions/setup-python@v3
      - run: python -m pip install --upgrade pip wheel
      - run: pip install tox tox-gh-actions
      - run: tox
      - uses: codecov/codecov-action@v3
        with:
          files: ./coverage.xml
          fail_ci_if_error: true
          token: ${{ secrets.CODECOV_TOKEN }}


================================================
FILE: .gitignore
================================================
*.py[cod]

# C extensions
*.so

# Packages
*.egg
*.egg-info
dist
build
eggs
parts
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__

# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject

docs/_build
venv*
.eggs
.ropeproject
tags
.idea
.vscode
htmlcov
*.swp
node_modules
.python-version


================================================
FILE: .readthedocs.yaml
================================================
version: 2

build:
  os: ubuntu-22.04
  tools:
    python: "3.11"

sphinx:
  configuration: docs/conf.py

python:
  install:
    - method: pip
      path: .
      extra_requirements:
        - docs


================================================
FILE: CHANGES.md
================================================
# python-engineio change log

**Release 4.13.1** - 2026-02-06

- Document that a process can have only one custom JSON module ([commit](https://github.com/miguelgrinberg/python-engineio/commit/119ec1ee1f486035e837625161eea10183b9c52b))
- Switch to Furo documentation template ([commit](https://github.com/miguelgrinberg/python-engineio/commit/15e59899fe6387eb0fbe14160dbf298c01c115d5))

**Release 4.13.0** - 2025-12-24

- Apply escaping rules when parsing cookie values ([commit](https://github.com/miguelgrinberg/python-engineio/commit/04e7c4dd4792d1f551b71930ec771fbb96cdaaf2))
- Several minor improvements to the aiohttp integration [#419](https://github.com/miguelgrinberg/python-engineio/issues/419) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f7cb71c9d7ef961e839f0eb1e570d76b4ce481da)) (thanks **PaulWasTaken**!)
- Clarify logging behavior in documentation [#421](https://github.com/miguelgrinberg/python-engineio/issues/421) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7fe1771e7463960f6ef08f9bcc22b42c8df1012b)) (thanks **ZipFile**!)
- Address deprecation warnings [#422](https://github.com/miguelgrinberg/python-engineio/issues/422) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b90cbf2b981c301968611b495dd548c4b0153223))
- Add 3.14 and pypy-3.11 CI builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/df3d9741495d93f4ad0f2ec9f7b3a1d795f2234c))
- Drop Python 3.8 and 3.9 from CI builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/697b50f5bbc68b2416778d537ed88fefc8b004f0))

**Release 4.12.3** - 2025-09-28

- Reset client queue upon disconnection [#414](https://github.com/miguelgrinberg/python-engineio/issues/414) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/af57bf235b824f7f179a68ef61a03d76a2c56655))
- Support `['*']` in addition to `'*'` in the `cors_allowed_origins` option [#410](https://github.com/miguelgrinberg/python-engineio/issues/410) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d59658c22207a8ca9f8c9c28312887da8fd9ee29)) (thanks **Wu Clan**!)

**Release 4.12.2** - 2025-06-04

- Support new monkey-patched gevent `Queue` class in the client [#403](https://github.com/miguelgrinberg/python-engineio/issues/403) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/dcde006b62e004c8a1d29d3478c95fbffbb11122))
- Better support of the ASGI spec when interpreting WebSocket events [#405](https://github.com/miguelgrinberg/python-engineio/issues/405) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/86cb4d22be1735f0346f35ecb912818479b74f05)) (thanks **Eric Zhang**!)

**Release 4.12.1** - 2025-05-11

- Accept empty binary values in the async server [#404](https://github.com/miguelgrinberg/python-engineio/issues/404) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/83691dd46336f10de8f288b3aa23b60e211307e1))
- Add SPDX license identifier [#401](https://github.com/miguelgrinberg/python-engineio/issues/401) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b7f1e680f7d012294402c7e2a50d7dbcd9b2e40f)) (thanks **Marc Mueller**!)

**Release 4.12.0** - 2025-04-12

- Optimize packet parsing to avoid unnecessary calls to JSON parser [#399](https://github.com/miguelgrinberg/python-engineio/issues/399) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2dda203103d93bc751ab0967719f18318cffc8da))
- Pass `environ` as a second argument to callable option `cors_allowed_origins` [#398](https://github.com/miguelgrinberg/python-engineio/issues/398) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5cb561101dfcaed06bc9d73486515da93ead1752)) (thanks **wft-swas**!)

**Release 4.11.2** - 2024-12-29

- Fix incorrect disconnection reason reported when browser page is closed ([commit](https://github.com/miguelgrinberg/python-engineio/commit/132fbd9b2728c342fb989d559fa8c24b324c3cf3))

**Release 4.11.1** - 2024-12-17

- Remove debugging prints :blush: ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ded35d682690bf8a74d6df1325ec5b7e28d6eed6))

**Release 4.11.0** - 2024-12-17

- Pass a `reason` argument to the disconnect handler [#393](https://github.com/miguelgrinberg/python-engineio/issues/393) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d782d9b9adc04fb691a490f29713239ad40de6c5))
- Add `maxPayload` to connection response [#392](https://github.com/miguelgrinberg/python-engineio/issues/392) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/12e423fecd15c17ddecbef396844634431c45836)) (thanks **HeySMMReseller & HeySMMProvider**!)
- Client option to disable timestamps in connection URLs [#386](https://github.com/miguelgrinberg/python-engineio/issues/386) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e8f9bbafc8c3ef8126dbe06343d0a30e32074627))
- Return disconnected sessions as 400 errors [#391](https://github.com/miguelgrinberg/python-engineio/issues/391) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/55a9e46ff91aacfc04cb21683e12345e71fe2f98))
- Handle unicode errors in ASGI driver [#389](https://github.com/miguelgrinberg/python-engineio/issues/389) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/44ce778c9a7e26d62254563e3de8c4a0c073bdc0))
- Replaced deprecated `get_event_loop` with `get_running_loop` [#384](https://github.com/miguelgrinberg/python-engineio/issues/384) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a6e5d92ca98b41d2054737c6c49fc0511da0c3c6))
- Remove constructs required by older, now unsupported Python versions ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2f257c3f83be91a464141ff4d8366cdcd7d9543b))
- Switched to pyenv-asyncio for async unit tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/08ea5ad5127e3505120ddc8ac12657f3f70f9fef))
- Adopted `unittest.mock.AsyncMock` in async unit tests instead of homegrown version ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0a25a1d404dd8aab968e2b8aef870ad52c858dfc))
- Removed tests dependency on `unittest.TestCase` base class ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7de6d63f4034c4e8610e02c0c3478f8b97e1bc65))

**Release 4.10.1** - 2024-10-15

- Reject request with incorrect transport [#367](https://github.com/miguelgrinberg/python-engineio/issues/367) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7ad14481695df5adb070d52a377de49f43ddf399))

**Release 4.10.0** - 2024-10-13

- Reject requests with incorrect transport [#367](https://github.com/miguelgrinberg/python-engineio/issues/367) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4d614e5297ed2291ae97fcf30a3ee7223886440a))
- Fixed runtime error when disconnecting all clients [#368](https://github.com/miguelgrinberg/python-engineio/issues/368) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b3339974c68dcf0e3f85c524450748c24c3a9223))
- More flexible handling of the ASGI path [#359](https://github.com/miguelgrinberg/python-engineio/issues/359) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/972687b10c9a0fecb1c08fcd30dbd7b5a97c3a52))
- Remove unused parameter in log message [#377](https://github.com/miguelgrinberg/python-engineio/issues/377) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f9a818d1444c9167457fc9f6fca3667ac7a46cf7))
- Minor updates to the server and client documentation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/fe56a33fe37355dbdcd6a283f32e372f60115236))
- Add Python 3.13 CI builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e0e577dfd1bc8f79c5f8b033aed61947d44a5ec6))
- Run tests with mocked eventlet to avoid 3.13 failures ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5b5d67d1ffd98b31eb8fb30417152cb05af6fc97))

**Release 4.9.1** - 2024-05-18

- Fix inverted shutdown logic in async service task [#354](https://github.com/miguelgrinberg/python-engineio/issues/354) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8e688ba42de8aa9418f15943e0084f5626b092be))
- More robust WebSocket close detection in the sync client [#346](https://github.com/miguelgrinberg/python-engineio/issues/346) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ec2df3f99fc02234c43ff01e2a75fb40c0df0409))
- Option to disable routing in ASGIApp [#345](https://github.com/miguelgrinberg/python-engineio/issues/345) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1dbd57334499e839709ec951925b42ddfa70c57f)) (thanks **Rodja Trappe**!)

**Release 4.9.0** - 2024-02-05

- More robust handling of polling disconnects [#254](https://github.com/miguelgrinberg/python-engineio/issues/254) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e0bb263499525f5bd7eeb5195eea2dbf049d92b2))
- Clearer client logs after disconnect [#342](https://github.com/miguelgrinberg/python-engineio/issues/342) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5b538a74061d893f255ac3544ffe1402ae97b58e))

**Release 4.8.2** - 2024-01-06

- Combine ssl_verify with other SSL options ([commit](https://github.com/miguelgrinberg/python-engineio/commit/cea2f92b7094dba8b1b0943bab9e833a5362affe)) (thanks **Simon Fonteneau**!)
- Hold references to background tasks to avoid garbage collection ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0729554455d9ab1bdd36e6386272fb2d6b5607c6))
- Clearer documentation for the `max_http_buffer_size` argument ([commit](https://github.com/miguelgrinberg/python-engineio/commit/88b19f93ffea7bc1e9527889b9c2b830d082ce6b))

**Release 4.8.1** - 2023-12-28

- Fix invalid WebSocket responses [#331](https://github.com/miguelgrinberg/python-engineio/issues/331) [#332](https://github.com/miguelgrinberg/python-engineio/issues/332) [#338](https://github.com/miguelgrinberg/python-engineio/issues/338) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ccc7a86886f507bd7aa6985e5d1b070f9505ac46))

**Release 4.8.0** - 2023-10-14

- Return consistent responses after Websocket connection ends ([commit](https://github.com/miguelgrinberg/python-engineio/commit/785c77c39d8c8fee37f969981f5a28ed2cc1b769))
- Migrate Python package metadata to pyproject.toml ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f13b64d489ea99764f1a889987b1087f879967ea))
- Remove Python 3.7 from builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f3717b244b6df09562760cc7e232d26a056bb1c2))
- Internal code restructure (no functional changes) ([commit #1](https://github.com/miguelgrinberg/python-engineio/commit/e26163c8bbc2341e30f91b6acba06b9157247562)) ([commit #2](https://github.com/miguelgrinberg/python-engineio/commit/f15527bc48e2d3da1668e09ab801e594f85b20d5)) ([commit #3](https://github.com/miguelgrinberg/python-engineio/commit/5c996bec85d864526fe41569438a6e15e4a53123)) ([commit #4](https://github.com/miguelgrinberg/python-engineio/commit/ca9ca5bdd1467929be311d5ddcbfd18b5f4231ae))

**Release 4.7.1** - 2023-09-12

- Replace gevent-websocket with simple-websocket when using gevent ([commit](https://github.com/miguelgrinberg/python-engineio/commit/614f564275c635dc8b03d33dab44bf80d280cbcc))
- Catch and log all errors that occur in event handlers ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2bef6d6fbbe684e5718f9202cd7af0ad19153495))
- Use daemon threads for background tasks also in the threaded client ([commit](https://github.com/miguelgrinberg/python-engineio/commit/53578088046ca9f29b6119c182c7bed67d7a4ffb))
- Silence exception on websocket exit when using uWSGI [#330](https://github.com/miguelgrinberg/python-engineio/issues/330) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9bc9e867e28e2495031bd1a552f4da0b1f0f575c))

**Release 4.7.0** - 2023-09-03

- Added `send_packet()` method ([commit](https://github.com/miguelgrinberg/python-engineio/commit/48451a3a18c40c58cc5d4127250e4776e5b7f8db))
- Fixed race condition when lots of connections are ended at the same time [#328](https://github.com/miguelgrinberg/python-engineio/issues/328) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bb87ec652f55b41063400205971b0a667b78b162))
- Workaround for strange memory leak in Eventlet's `Thread` class [#328](https://github.com/miguelgrinberg/python-engineio/issues/328) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d29aa9c44450c4ea729a0846091e3b105b8b7497))
- Use daemon threads for background tasks in threading mode ([commit](https://github.com/miguelgrinberg/python-engineio/commit/541f172a4a61ebc16ee32fa38b0f410c4c711fbf))
- Upgrade to pypy-3.9 in unit tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4581e53ada773fef8976110cc6d4ae40783b38d8))

**Release 4.6.1** - 2023-08-23

- Fix double close of websockets in ASGI adapter [#327](https://github.com/miguelgrinberg/python-engineio/issues/327) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e629eee17d7df7dc9736763b4220daed54a6dbdf))

**Release 4.6.0** - 2023-08-21

- Improvements in the connection rejected flow ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8051fc49f484585b786031a08617208efdc97f5a))
- Better handling of Gunicorn threaded worker ([commit](https://github.com/miguelgrinberg/python-engineio/commit/29e4492cdf836a2197479c5946089b2363305379))
- `shutdown()` method for the Engine.IO server ([commit](https://github.com/miguelgrinberg/python-engineio/commit/87f6003653b45fe2b230d8c33c8962e15e71e157))

**Release 4.5.1** - 2023-07-06

- Restore support for old versions of eventlet [#321](https://github.com/miguelgrinberg/python-engineio/issues/321) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/503c8651658e26276f3206655a819f79eb25739e))

**Release 4.5.0** - 2023-07-05

- Configure eventlet's websocket max frame length [#319](https://github.com/miguelgrinberg/python-engineio/issues/319) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1b04a562322a386ef806f1ada73e83d40fa1f0ce))
- Remove old Python 2 syntax in `super()` calls ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b37ee7697418c9a982af570758044d0e728e2ce2))

**Release 4.4.1** - 2023-04-19

- Prevent crash when closing simple-websocket connection [#311](https://github.com/miguelgrinberg/python-engineio/issues/311) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/71e7d3688947779d2f086014e117ebb66606145e))
- Fix server/client mixup in client docstrings [#312](https://github.com/miguelgrinberg/python-engineio/issues/312) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/911cf520034ee17bcc9311e244e616848cfff095)) (thanks **Sasja**!)

**Release 4.4.0** - 2023-03-16

- Allow configuring underlying websocket connection with custom options [#293](https://github.com/miguelgrinberg/python-engineio/issues/293) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/45e97b8cf885e998168857c46e29a7e257754f3e)) (thanks **Bruce Yu**!)
- Cancel all running tasks in async SIGINT handler [#306](https://github.com/miguelgrinberg/python-engineio/issues/306) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0d263b0e40460c334a0b259804f2ff156bc3718c))
- Handle unexpected WebSocket close frames sent by server [#292](https://github.com/miguelgrinberg/python-engineio/issues/292) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4f67c95f8631e624e44afe5bdfccfff924b232c9))
- Close aiohttp session after a failed connection [#307](https://github.com/miguelgrinberg/python-engineio/issues/307) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/86ed2ae9f84578b9c6b7a6839c3b82304a65725f))
- Catch IOErrors from uWSGI and explicitly close the driver [#301](https://github.com/miguelgrinberg/python-engineio/issues/301) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/678ae8b0efa6c12ae36d5c5b362e50aabc8dc8e9)) (thanks **June Oh**!)
- Recommend ASGI integration for Sanic in Documentation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bf9d8eabe02c2aadce22e70b71375ccc2bd21e79))
- Fix documentation for `max_http_buffer_size` [#310](https://github.com/miguelgrinberg/python-engineio/issues/310) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8182f783830b9fda9abc8e2410e7f397c0f62482)) (thanks **Lawrence Ong**!)
- Add Python 3.11 to builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4a8a9a640fd4567d8c6001e1058e9980af3067ff))

**Release 4.3.4** - 2022-08-03

- Let companion ASGI app handle lifespan events [#287](https://github.com/miguelgrinberg/python-engineio/issues/287) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1c9001c537fd669a3b0e28d75f707216ec48befa))
- Use configured request timeout when making a WebSocket connection [#286](https://github.com/miguelgrinberg/python-engineio/issues/286) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f6df30b841a86f96765c307efa99a7505dd9b4c1)) (thanks **jpfarias**!)

**Release 4.3.3** - 2022-07-04

- Handle ASGI lifespan when running with a secondary ASGI app [#284](https://github.com/miguelgrinberg/python-engineio/issues/284) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c4a021ee9c4d760bbe4066887ca816fc7c718f98)) (thanks **mozartilize**!)
- Update deprecated usage of `asyncio.wait()` [#281](https://github.com/miguelgrinberg/python-engineio/issues/281) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d3a23c0936cda2ff3de8c5ae0c834ffef515e8cb)) (thanks **Ben Beasley**!)
- Better handling of queued WebSocket messages in uWSGI [#256](https://github.com/miguelgrinberg/python-engineio/issues/256) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ec7b3da2e48060e177bf8ad6a9f5fae445207c82))
- Gracefully fail to decode empty packets [#269](https://github.com/miguelgrinberg/python-engineio/issues/269) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9c657071f3d42a88fd1615b5edd245a89445ea1b))
- Only attempt to set an async signal handler once [#276](https://github.com/miguelgrinberg/python-engineio/issues/276) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6869751aafb6db83d1a53fbd47d3fbfd2a8ae490))

**Release 4.3.2** - 2022-04-24

- Option to use a callable for `cors_allowed_origins` [#264](https://github.com/miguelgrinberg/python-engineio/issues/264) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/60e8e553e1fc64a5b0dbb846a86c5c0698101a9e))
- Close aiohttp session when disconnecting [#272](https://github.com/miguelgrinberg/python-engineio/issues/272) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a9fb317c29d93b98a729df800f124b6b923fc82c))
- Remove 3.6 and pypy-3.6 builds, add 3.10 and pypy-3.8 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/06480be268852ffc96793ef52213ad598b85fa69))

**Release 4.3.1** - 2022-01-11

- Fix support for Sanic v21.9.0 and up ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b0157d5a7e35ad83bc33f363b154402838fac83b)) (thanks **13g10n**!)
- Include example code in flake8 pass ([commit](https://github.com/miguelgrinberg/python-engineio/commit/776bb86bb560bcd1912350bc24382fe6090c9c84))
- Remove unused `__version__` constant [#262](https://github.com/miguelgrinberg/python-engineio/issues/262) ([commit 1](https://github.com/miguelgrinberg/python-engineio/commit/e882f5949bdd1618d97b0cade18a7e8af8670b41) [commit 2](https://github.com/miguelgrinberg/python-engineio/commit/ed4b1e2b8b18ac5adb2ee9a2ef126a4e5ffee128))

**Release 4.3.0** - 2021-10-26

- **Backward incompatible change**: Reject websocket messages larger than `max_http_buffer_size` [#260](https://github.com/miguelgrinberg/python-engineio/issues/260) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5f519a22b9543f585adc352e13f2a9b3cbfca727))
- Enable or disable specific transports [#259](https://github.com/miguelgrinberg/python-engineio/issues/259) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8a0e4c3a406358065ef4eb878e60d2dc3b758bf4)) (thanks **Maciej Szeptuch**!)
- Option to disable the `SIGINT` handler in the client ([commit](https://github.com/miguelgrinberg/python-engineio/commit/14ed9f1d8f19e87a13b427427a6597e72d51db57))
- Support binary packets with zero length [#257](https://github.com/miguelgrinberg/python-engineio/issues/257) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bcd1a42f86aad12460b6eb836a5c317db55cba77))
- Improve documentation on `start_background_task()` function ([commit](https://github.com/miguelgrinberg/python-engineio/commit/531d28ae2583e30c17ec7a0c911cde0343663244))
- Remove unsanitized client input from error messages [#250](https://github.com/miguelgrinberg/python-engineio/issues/250) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/72b7136cffd67d4299cb3dab17d1632a30ef5207)) (thanks **André Carvalho**!)
- Use plaintext Content-Type when using polling [#248](https://github.com/miguelgrinberg/python-engineio/issues/248) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c2603e9ddc7ff96a8fe7beced751aea1480ec5e6)) (thanks **Tobias**!)
- Return better error messages for client connection errors [#243](https://github.com/miguelgrinberg/python-engineio/issues/243) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3daa02e198aca9657cb04ea91ba4e3234113bde9))
- Reuse the aiohttp client session on reconnects [#226](https://github.com/miguelgrinberg/python-engineio/issues/226) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3c8fdfe05864e43ad8f35214fa2ad27bcb24965f))

**Release 4.2.1** - 2021-08-02

- Support setting `socketio_path` to the root URL [#242](https://github.com/miguelgrinberg/python-engineio/issues/242) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/47ada56b1ada2ed6eeb8c0fe172045bed321a037))
- Use the gevent selector to avoid 1024 file handle limitation of select[#228](https://github.com/miguelgrinberg/python-engineio/issues/228) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6a4fd582e23d03d90b67b6825518a6c73431c6dd))
- Pass reason when closing a WebSocket connection ([commit](https://github.com/miguelgrinberg/python-engineio/commit/583c7db1f9dfa62290481634b4f9ab4d39a8ec6b))
- Improved project structure ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bf37732b38b6d798f86fdf5c3d26b8e306e34655))
- Remove executable permissions from files that lack shebang lines [#240](https://github.com/miguelgrinberg/python-engineio/issues/240) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7a4e2780f9ea3466a8a14e3f1720561773faee7c)) (thanks **Ben Beasley**!)

**Release 4.2.0** - 2021-05-15

- WebSocket support for threading mode ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b84537af22e547211163521f7bc85995faab3625))
- Fixed CORS handling of scheme proxy server header [#1501](https://github.com/miguelgrinberg/Flask-SocketIO/issues/1501) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/fb47df6949c10c35d6630daacb3d511d2086f1b3))
- Correct handling of static files when secondary WSGI/ASGI app is set [#653](https://github.com/miguelgrinberg/python-socketio/issues/653) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bd2e59d0b37e86fd561f716f2d805081200f896e))
- Remove outdated binary argument from example code ([commit](https://github.com/miguelgrinberg/python-engineio/commit/090454ffe66ebe7e830ecbd859f0416c7bc74eee))
- Added Open Collective funding option ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9e3497a9749aebc87268250673cebba35c6922cf))

**Release 4.1.0** - 2021-04-15

- Change pingTimeout to 20 seconds to match JavaScript's Socket.IO 4.x releases ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1e29203b41ee5f1bbde17bf77a909183fc66033a))
- Configure the JSON decoder for safer parsing ([commit](https://github.com/miguelgrinberg/python-engineio/commit/dd1db2ec6b75a95bfab5e73a8f71fdb69bd54534)) (thanks **Onno Kortmann**)
- Remove obsolete 'mock' dependency [#218](https://github.com/miguelgrinberg/python-engineio/issues/218) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/845fc6201a783d14e02924c593028d3d06600d73)) (thanks **Michał Górny**!)

**Release 4.0.1** - 2021-03-10

- Support for client to verify server with custom CA bundle ([commit](https://github.com/miguelgrinberg/python-engineio/commit/792bdd040a460d0f77309ed1c7d9fea236542140)) (thanks **Brandon Hastings**!)
- Report missing websocket client as an error in log [#557](https://github.com/miguelgrinberg/python-socketio/issues/557) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2f806acc927ac334541f77455b3a51a879649aeb))
- Remove asyncio client delay before attempting reconnection [#622](https://github.com/miguelgrinberg/python-socketio/issues/622) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1d174b7bc47d4958a9829130321f8c87141007d7))
- Fix error handling for ASGI WebSocket errors [#210](https://github.com/miguelgrinberg/python-engineio/issues/210) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e8e4ba5d1c832e14568e575ecdd173395493ea48))
- Fix logging of missing sid [#1472](https://github.com/miguelgrinberg/Flask-SocketIO/issues/1472) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/cdfc1d88151a9f9f81082810db74fa3882d8adca))
- Change deprecated `body_bytes` in sanic to `body` [#207](https://github.com/miguelgrinberg/python-engineio/issues/207) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e16bbcac1c76dbab61dd378768128af5dfeb8357)) (thanks **Alison Almeida**!)
- Remove references to Python 3.5 in the documentation [#211](https://github.com/miguelgrinberg/python-engineio/issues/211) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/753656374ee74aedc8a70e92ea717d4ddb5c95dc))
- Added performance testing scripts ([commit](https://github.com/miguelgrinberg/python-engineio/commit/28fe975daf239a2612e59843f06c52a72cfea84b))

**Release 4.0.0** - 2020-12-07

- Implementation of the Engine.IO v4 protocol revision
    - v4 protocol: ping/ping reversal in the server ([commit](https://github.com/miguelgrinberg/python-engineio/commit/52774aaf019c1560ba2d46d7fb32668516fb9aff))
    - v4 protocol: ping/ping reversal in the client ([commit](https://github.com/miguelgrinberg/python-engineio/commit/76a0615ec02818b1aba38ced38e5f6cefc40790d))
    - v4 protocol: change max http buffer size to 1MB ([commit](https://github.com/miguelgrinberg/python-engineio/commit/38e20a3f31ffc566d521a80f0d13499a4de8e67e))
    - v4 protocol: do not set the io cookie by default ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f17663608178d4ee5f0ab9f1d4523813b96f3e1f))
    - v4 protocol: use EIO=4 in connection URL ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b474d70b413307be5b713d3f7e3b79dbd1b631a4))
    - v4 protocol: new payload separator ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e895d6f5d0fa88566df61ffd316ce31d7cecfb90))
    - v4 protocol: new binary encoding format ([commit](https://github.com/miguelgrinberg/python-engineio/commit/38beea5f7903af2e79ab3654b0c299aba2f226da))
- Use a sid generator algorithm similar to JavaScript's version of Socket.IO ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0583c1e8b122e4c7620e04429bf4f901bad551bd))
- Ignore case when comparing transport argument against 'HTTP_UPGRADE' header ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3d7ea22e8a9930544c711c5e124f75121b300ef3)) (thanks **Matthew Barry**!)
- Remove dependency on the six package ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c181e8563edf1586eb3f2baacaf4f2c26b1a2593))

**Release 3.14.2** - 2020-11-30

- Log first occurrence of bad request errors at level ERROR for higher visibility ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3fc702f459554ccbdfaaad2673b6063d2ef4485e))

**Release 3.14.1** - 2020-11-28

- Catch more connection exceptions in the asyncio client [#561](https://github.com/miguelgrinberg/python-socketio/issues/561) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0d8d3a66292e2bc71b5af5b3e2162fde02c3f487))
- Revert "On Windows use SIGBREAK to break client" since the fix was not effective ([commit](https://github.com/miguelgrinberg/python-engineio/commit/788cf86a0b6223546b085966e800466a25fe07e1))

**Release 3.14.0** - 2020-11-28

- Reject incorrect Engine.IO protocol versions ([commit](https://github.com/miguelgrinberg/python-engineio/commit/00330bbc4292f50e5a7726f28c028f6cd7c90aa5))
- Accept an initialized requests or aiohttp session object ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f371ad17f3a261366cde124f926bf62dc191a9ea))
- Handle ping interval and timeout given as strings [#201](https://github.com/miguelgrinberg/python-engineio/issues/201) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1751039070da3fee381568f2b017aa83bef36bf1)) (thanks **Akash Vibhute**!)
- Handle websocket connections without upgrade header [#72](https://github.com/miguelgrinberg/python-engineio/issues/72) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/da4afaa6ed80f7cce6e102a51ff03390267b51a1))
- Catch broken pipes and OS errors in websocket thread [#177](https://github.com/miguelgrinberg/python-engineio/issues/177) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0dde7d7ae19478a56610b3a06f76419013e60d62))
- Expose ASGI scope in connect environ [#192](https://github.com/miguelgrinberg/python-engineio/issues/192) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3a58d406427a5ac99803c4b4d516b5478022b3c6)) (thanks **Korijn van Golen**!)
- Emit ASGI lifespan shutdown event [#200](https://github.com/miguelgrinberg/python-engineio/issues/200) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2fb17746e72c74a2bce6a1169b6f841ac3473ea9))
- Add option to set cookie SameSite and Secure settings. ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8f175760eb95b9c67548c5d9969765f710d40296)) (thanks **Billy Felton**!)
- Stop event loop when client is interrupted with Ctrl-C [#197](https://github.com/miguelgrinberg/python-engineio/issues/197) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/402402f7c19760e84d0c32abc8e729baff51623d))
- Do not try to install signal handler if unsupported [#199](https://github.com/miguelgrinberg/python-engineio/issues/199) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c0a1c2801cb35e6d192ddf542f79359c823655aa)) (thanks **Philippe**!)
- On Windows use SIGBREAK to break client [#570](https://github.com/miguelgrinberg/python-socketio/issues/570) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f5fda518d8943be7846321275760a589a1e63bc0))
- Client: handle error responses with invalid JSON [#553](https://github.com/miguelgrinberg/python-socketio/issues/553) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f543839512b960c904f73cf5ea2a647b058c8bf7))
- Added troubleshooting section to the documentation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/32e0e2992f9d109dbad7124b615e97d6e8b3285d))
- Move builds to GitHub actions ([commit](https://github.com/miguelgrinberg/python-engineio/commit/232f165a2d2b41b62f540ed6b77c8db722c6dc4f))

**Release 3.13.2** - 2020-08-18

- Improved signal handler for the async client [#523](https://github.com/miguelgrinberg/python-socketio/issues/523) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/eabfdaa9d1644d3346ec3ec7fae040c85029b75e))
- Add SameSite attribute to Socket.IO cookie [#1344](https://github.com/miguelgrinberg/Flask-SocketIO/issues/1344) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2ec2bac6d7738b89ae0fe0645e30d50dd100cab1))
- Handle GeneratorExit exception appropriately [#182](https://github.com/miguelgrinberg/python-engineio/issues/182) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c7ab55269e0cf94c7684675101d910d740f179cc)) (thanks **PaulWasTaken**!)
- Simplify asserts in unit tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/638c1fa4d54a7cfa20711df5a1b3e8e1e3754c3d))
- Use pytest as test runner ([commit](https://github.com/miguelgrinberg/python-engineio/commit/dcea3a09775cc054b4b937d6d8c1caff5af4f617))

**Release 3.13.1** - 2020-07-02

- Fix KeyError during WebSocket disconnection in AsyncServer [#179](https://github.com/miguelgrinberg/python-engineio/issues/179) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f43807b26ea1a185ff0b9f569dd586ca77b8da67))

**Release 3.13.0** - 2020-05-23

- Support direct WebSocket connections in ASGI server ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c0e2817bddf2c12e72cbfe7e2ca4bb3f41392af5))
- ASGI startup and shutdown lifespan handlers [#169](https://github.com/miguelgrinberg/python-engineio/issues/169) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/38cc39f527e4913f3fee519a2f13f218056343a7)) (thanks **avi**!)
- Improved handling of rejected connections ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0e0b26f89bea6b0662c1d1748c5ae1fde5668207))
- Make client disconnects more robust [#417](https://github.com/miguelgrinberg/python-socketio/issues/417) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4297eb4a9033029cd0061e3ddd5d46974b8e4d9e))
- End WebSocket connection gracefully when user is intentionally disconnected [#168](https://github.com/miguelgrinberg/python-engineio/issues/168) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e4d9c33216a851ca0261b0944d4c08afcc05ae1e)) (thanks **Mohammad Almoghrabi**!)
- Enable locking in websocket-client package [#170](https://github.com/miguelgrinberg/python-engineio/issues/170) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f7bbd97a68022b25f7d70c044cbff4328c50e909))
- Correctly parse cookies with a "=" in their values [#175](https://github.com/miguelgrinberg/python-engineio/issues/175) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8c1d98c056ac69b04d8a1412a70563909b19f7e6)) (thanks **Ignacio Pascual**!)
- Removed references to Python 2.7 in the documentation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5b79e28d8a2c5349590f9ea23d9cb8142c165295))

**Release 3.12.1** - 2020-03-17

- Asyncio client: correctly update cookie jar [#166](https://github.com/miguelgrinberg/python-engineio/issues/166) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5f2c7f640cbe1620387b6843683b2150dc713d82))

**Release 3.12.0** - 2020-03-14

- Correct handling of cookies in the client [#162](https://github.com/miguelgrinberg/python-engineio/issues/162) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/59a0cd43f7fabc2c6b2546c59e72f8376b9f85cc))
- Fixed infrequent race condition when upgrading from polling to WebSocket [#160](https://github.com/miguelgrinberg/python-engineio/issues/160) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f2cce2bccb7fca58bb6115630d5c221569e52ba4))
- Only add signal handler when client is created in main thread [#163](https://github.com/miguelgrinberg/python-engineio/issues/163) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e1ed079a8dafe2b9ca596fa2fc2885a91d1b486d))
- More robust handling of a closing connection [#164](https://github.com/miguelgrinberg/python-engineio/issues/164) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bdd584b3b3ca87f37f89921e54d5b27ec5fd7953))
- More accurate logging documentation [#158](https://github.com/miguelgrinberg/python-engineio/issues/158) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5260f5c4d8e6091fb913be9b688d61e36c11fb26))

**Release 3.11.2** - 2020-01-03

- Last version to support Python 2
- Detect unreported websocket closures in asyncio client [#401](https://github.com/miguelgrinberg/python-socketio/issues/401) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a67b3d76d80e665ec071292dc4aadffb50be6d3f))
- Initialize aiohttp when client connects directly through websocket [#152](https://github.com/miguelgrinberg/python-engineio/issues/152) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9a3d6453bd35bc9581b5dd9226dc9e6bba3a18aa))
- Initialize the client's SIGINT signal handler only if a client is created [#147](https://github.com/miguelgrinberg/python-engineio/issues/147) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6534d324f3dce2e1e4927932660d5e5e8bcab202))
- Add better exception handling for errors thrown by the websocket-client package [#155](https://github.com/miguelgrinberg/python-engineio/issues/155) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/33c7cf1ba9ecc8dd24b0d850dfe334d425474612)) (thanks **Adam Grant**!)
- Missing timeout when closing websocket client connection [#148](https://github.com/miguelgrinberg/python-engineio/issues/148) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/02a2c705b01f171edea106a7ee867b6112074853))

**Release 3.11.1** - 2019-12-10

- Reset event when it is reused after a reconnect [#153](https://github.com/miguelgrinberg/python-engineio/issues/153) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/179d0df931724f1c518d09417012e0adc90501fd))

**Release 3.11.0** - 2019-12-07

- Use aiohttp's WebSocket client [#324](https://github.com/miguelgrinberg/python-socketio/issues/324) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/280aa0f00c0ca3d099c2a693f6c2ce7919d2dc86))
- Support user created loops on the asyncio client [#1065](https://github.com/miguelgrinberg/Flask-SocketIO/issues/1065) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e38daad301d4b855cabf6a289b7348a58a314273))
- Fix occasional server disconnect crashes [#146](https://github.com/miguelgrinberg/python-engineio/issues/146) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9f96cd827c59776cb7da72614891be05681e5063)) (thanks **Dominik Winecki**!)
- Use X-Forwarded headers if present to verify origin ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3c221aaec7173a046ca42f6aff9be0915cf92237))
- Support async `make_response` function in ASGI driver [#145](https://github.com/miguelgrinberg/python-engineio/issues/145) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3f6391ca3229d26f081a16436cd4acd292ee69df))
- Support not having a sigint handler [#143](https://github.com/miguelgrinberg/python-engineio/issues/143) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/fc984aaa5e5dc91f6632729e56b34628f2fd2563)) (thanks **Robin Christine Burr**!)
- Fix websocket exception handling on python2.7 [#149](https://github.com/miguelgrinberg/python-engineio/issues/149) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b714f81a0ee27e30070a5ca702a1823236df9981)) (thanks **Payton Yao**!)

**Release 3.10.0** - 2019-10-22

- Added support for SSL connection to unverified host in the client. [#137](https://github.com/miguelgrinberg/python-engineio/issues/137) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/51da0bed3c93c41b980bb565560c7233da3501f5)) (thanks **sgaron-cse**!)
- Performance improvements in parsing long-polling payloads ([commit](https://github.com/miguelgrinberg/python-engineio/commit/64a34fc1550458ded57014301d5f9e97534f0843))
- Prevent heavy CPU usage when decoding payloads ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c8407ae97821bb00c33a91114f425b8454f5e50e))
- Handle case where no original SIGINT handler existed and call signal.… [#140](https://github.com/miguelgrinberg/python-engineio/issues/140) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9b4a10fede2ef3a9e85f370f48b6720fe7a15f35)) (thanks **Robin Christine Burr**!)
- Accept any 2xx response as valid in the client [#331](https://github.com/miguelgrinberg/python-socketio/issues/331) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9d4ab4bb519d898ef170815deb767b85aeefd141))
- Avoid loop without yield when sockets are >60 [#138](https://github.com/miguelgrinberg/python-engineio/issues/138) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5c6fbeac0e9f0788d300cf06de74ce65f8994f05)) (thanks **Gawen Arab**!)
- Configurable ping interval grace period [#134](https://github.com/miguelgrinberg/python-engineio/issues/134) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bb2401354c3b7c3cf6a5577db83cc51ae071836e))

**Release 3.9.3** - 2019-08-05

- Apply timeouts to all HTTP requests sent from the client [#127](https://github.com/miguelgrinberg/python-engineio/issues/127) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6666d6a092333aa60f48ccdc42b250be60e9f33c))
- Shutdown non responding websocket connections in the client [#326](https://github.com/miguelgrinberg/python-socketio/issues/326) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/95731e9e2d66e8ee91faeb5538dcde84b88466bd))
- Catch OSError exceptions from websockets package [#328](https://github.com/miguelgrinberg/python-socketio/issues/328) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0adc074e58dac1d81f769ed1a2edfcab5e0644d1))

**Release 3.9.2** - 2019-08-03

- Skip CORS headers when origin is not given by client [#131](https://github.com/miguelgrinberg/python-engineio/issues/131) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a349d4e3ce25ff771027f986c7594d840cc9e941))
- Add `async_handler`s sub-package to setup.py ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e4163b64f3482d2d97dccf813a880cb6ad088533))

**Release 3.9.1** - 2019-08-02

- Restore CORS disable option [#329](https://github.com/miguelgrinberg/python-socketio/issues/329) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9f4cd8cf9e7be6baf4bc8c485e7ad204dd87be75))

**Release 3.9.0** - 2019-07-29

- Address potential websocket cross-origin attacks [#128](https://github.com/miguelgrinberg/python-engineio/issues/128) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7548f704a0a3000b7ac8a6c88796c4ae58aa9c37))
- Documentation for the Same Origin security policy ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5b5879469348c529c283e1d81032a603c5e69b31))
- Remove tests from built package [#124](https://github.com/miguelgrinberg/python-engineio/issues/124) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/399dc8acf2077856c4bd8edb22d0f254b47f0ca2)) (thanks **Pablo Escodebar**!)

**Release 3.8.2** - 2019-06-29

- Correctly autodetect asgi async mode [#122](https://github.com/miguelgrinberg/python-engineio/issues/122) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2690ea08b3d3beeaf34b5b4871ac1b567e048a9f))
- Omit response when asyncio websocket ends [#120](https://github.com/miguelgrinberg/python-engineio/issues/120) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f13074670dcd95e578d17f00b91845139e4f25eb))
- Improved ocumentation on user session behavior on disconnections ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6b8e667ad26c4e654f84b7f12b851c07d801211d))
- Correct spelling mistakes in documentation [#119](https://github.com/miguelgrinberg/python-engineio/issues/119) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a4404989a1c48b3522c09a7f6335f2ad401805a2)) (thanks **Edward Betts**!)

**Release 3.8.1** - 2019-06-08

- Optimization to static file serving ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5b8701042678b3e092e2be365bdd31b425b714f6))
- Do not reset connection when packet queue timeouts [#110](https://github.com/miguelgrinberg/python-engineio/issues/110) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e64e5a67b723400e20cb7c5a014413a4445d9184)) (thanks **Victor Moyano**!)

**Release 3.8.0** - 2019-06-03

- Much more flexible support for static files in the server ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b27cafb207589cc52b5ba1ffa60f9a2e1e553af9), [commit](https://github.com/miguelgrinberg/python-engineio/commit/a56aed103c39a25ff6afb316d171cfeca5bf9894))
- Correctly handle rejected websocket connections in Tornado [#114](https://github.com/miguelgrinberg/python-engineio/issues/114) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/51f5ad28d5c3a17bfad7d9b55555b23223eff43b))

**Release 3.7.0** - 2019-05-29

- Add JSONP support in the server [#98](https://github.com/miguelgrinberg/python-engineio/issues/98) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/36a15987a677ba5a61675250f9b4a9e7c6cbaa74)) (thanks **StoneMoe**!)
- Send binary packets as such in the sync client [#112](https://github.com/miguelgrinberg/python-engineio/issues/112) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/076232e86fa923c2f44472f8eb358b141c61783a))
- Handle CLOSE packet in the client [#100](https://github.com/miguelgrinberg/python-engineio/issues/100) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/612815f793f4c749c9a9459ff08804ddd629da31))
- Document how to access the sid for the connection ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3de448881989485e0f986441896a1871354ba36a))

**Release 3.6.0** - 2019-05-25

- Tornado 6 support ([commit](https://github.com/miguelgrinberg/python-engineio/commit/99359e43188f05e1844b68fef862f3af99919044)) (thanks **Michel Llorens**!)
- added note on CORS support for sanic ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a3a4cb82059e2229d1b5e9ed9404dacc1b9afc34))
- added python 3.7 build ([commit](https://github.com/miguelgrinberg/python-engineio/commit/805aa9fd7156425a2dce6b782b96f0e805ee4501))
- auto-generate change log during release ([commit](https://github.com/miguelgrinberg/python-engineio/commit/be2c76e3e5b803284a6f2a9e4abed3314b9af7b6))
- added change log ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f8b15d1c06439581ca6b0d697f67cd034fb5bbf5))
- helper release script ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d36548cade90ddf8c6ab68178cb9747d5ac0d51f))

**Release 3.5.2** - 2019-05-19

- migrate to ASGI3 [#108](https://github.com/miguelgrinberg/python-engineio/issues/108) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5a7f9e719b6fb3bfc9da07b882c4b77b102aef0d)) (thanks **Florimond Manca**!)
- updated asgi examples to latest uvicorn ([commit](https://github.com/miguelgrinberg/python-engineio/commit/261fd67103cb5d9a44369415748e66fdf62de6fb))
- remove security alert in requirements ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1b044aaac9657ff947c6666638cf89315303bf6c))
- removed unused arguments and methods ([commit](https://github.com/miguelgrinberg/python-engineio/commit/951b4c39af9ec22dbc06046d562866e0f32152cd))

**Release 3.5.1** - 2019-04-07

- Downgrade log levels in some areas [#103](https://github.com/miguelgrinberg/python-engineio/issues/103) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/57b81be14b1d2fd4701c1b1d3c07710661807983)) (thanks **Aaron Bach**!)
- capture timeouts and other exceptions from requests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/45397f1d2f7a7ea7ae6fb87049579bccf6cb1b87))

**Release 3.5.0** - 2019-03-16

- not necessary to hold the packet queue when upgrading ([commit](https://github.com/miguelgrinberg/python-engineio/commit/330c6b9379afb4a098c24456f1a96fed8c314b10))
- add link to stack overflow for questions ([commit](https://github.com/miguelgrinberg/python-engineio/commit/138fb60a9bb8a4aae86e08a5fd5485563733b9d1))
- pep8 fixes for previous commit ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0c15cdc29ff130dba2887f5bfc2623f57b4fb45c))
- Use the correct text type for upgrade probes in both Python 2 and 3 [#101](https://github.com/miguelgrinberg/python-engineio/issues/101) [#265](https://github.com/miguelgrinberg/python-engineio/issues/265). ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4f0b4ea83298701a2e192c1e42fc3e917f1ee989)) (thanks **Sam Brightman**!)

**Release 3.4.4** - 2019-03-14

- Pass cookies to websocket connection creation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c4c9178951aa2b9ede3ccec9af79324444e09314)) (thanks **Adrien Gavignet**!)
- close the aiohttp client to prevent exit warnings ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9f6db446034a579415ae17dc0490ba23d92c723d))
- readme fixes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d6a33d22cfd3ebe8b4d78cd5c27607de837d16e9))

**Release 3.4.3** - 2019-02-20

- exit service task if event loop is closed ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ee6e00d5d4131f1d120797528b94140c2006b848))
- more tornado fixes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/68ca0c2f3ebe2d255449a1f3a8b1b11d2deb84ef))

**Release 3.4.2** - 2019-02-19

- added missing await in tornado driver ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4ac92d4642f248ae763493c1d26e9e5f2058ac93))

**Release 3.4.1** - 2019-02-16

- check for origin in Tornado's WebSocket handler ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c4b506a0eb91a67e68944c8048ca9a867407c182))

**Release 3.4.0** - 2019-02-15

- replace urllib3 with requests to get cookie support ([commit](https://github.com/miguelgrinberg/python-engineio/commit/41b8e29e49560170e852df1c5c070c6d311452d5))

**Release 3.3.2** - 2019-02-12

- reset sid after a disconnect ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9aa774270b41c7ef5f7e7c3bee6c2b8c40936951))
- uniform service task cancellation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/82f6982b5f81f749600565266d9da9c108991eed))
- Fix hang on KeyboardInterrupt when running with asyncio. [#95](https://github.com/miguelgrinberg/python-engineio/issues/95) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c60499e689fd8ea1ee4db269fcd3a7f2ab7fbb08)) (thanks **Ingmar Steen**!)

**Release 3.3.1** - 2019-02-09

- better error handling during websocket connection handshake ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f4c49c44a9b83a9fdc286bb38ff3be39b165118b))
- more places where connection shouldn't be reset too quickly ([commit](https://github.com/miguelgrinberg/python-engineio/commit/693b51b2221d59863e2680acbf0f02170bb87a81))

**Release 3.3.0** - 2019-01-23

- do not reset connection when ping loop exits ([commit](https://github.com/miguelgrinberg/python-engineio/commit/dafbdb80ffb5eba0522adc14728bb47e13f0ac54))

**Release 3.2.3** - 2019-01-12

- never import invalid async drivers ([commit](https://github.com/miguelgrinberg/python-engineio/commit/61b04ea89cf2cc358a40f7854c31859aea8e30d6))

**Release 3.2.2** - 2019-01-10

- fixed unreliable unit test ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7e53442afa93d7155c49681050a7aacaaf7222e9))
- Fixes [#236](https://github.com/miguelgrinberg/python-socketio/issues/236) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e6c285882ed023c17e319cf2bd9c3322a524125a))
- fixed handling of queue empty exceptions [#88](https://github.com/miguelgrinberg/python-engineio/issues/88) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bc128c2e3f41a69d855acabdbdbad072f662df92))

**Release 3.2.1** - 2019-01-09

- add a grace period of 5 seconds to ping timeout ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b5f15e34ed9ef3a9f75d778c67e9bde4265618a7))
- do not use six in setup.py ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c41bb5d0431c0a5d3c49a98392f530a93fd093c0))
- minor refactor of clients for consistency with servers ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d9c278f326db52da1343c0f7fb4257ff7087e83c))
- minor refactor of the async drivers ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0478110179f91f51c6a7a972b3e284b06c3db2ee))

**Release 3.2.0** - 2019-01-03

- unit test reorganization ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3786502ed57920d6b78283bf16150f1711721d38))
- do not block upgrades with high packet traffic [#16](https://github.com/miguelgrinberg/python-engineio/issues/16) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/919d8ea639d5190d345b22168d6cbfbdebc421af))
- user session documentation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/af3a0aa7d5b83f8c407f792cb688ef6f983b056b))
- remove python 3.4 from builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8c9bbf4132f4cf4082c96d58a6e7270ad7eea0ff))
- user sessions ([commit](https://github.com/miguelgrinberg/python-engineio/commit/561efad215661bfce3d00ffcb5c3290555de8f12))

**Release 3.1.2** - 2018-12-22

- fixed dependency ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8f8cbfd866086c3689a65bc049e0a9ce597e08c2))
- small documentation updates ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d59648c663e2f54f96a824e947a86f62f45f637d))

**Release 3.1.1** - 2018-12-20

- bug fixes on handling of timeouts in the client ([commit](https://github.com/miguelgrinberg/python-engineio/commit/de1dbbd39f8516a89525282f4d24c7d854ecb321))
- make ping loop task more responsive to cancellation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6a997b960c985b35f28b5f60f1dc8d9e99e05c08))
- correct handling of disconnect event ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ccf1ddfa132a43fbe147c322608d913ede1d6c75))
- make unit tests compatible with python 3.5 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/aeabccdd59f7d8939c6af47d5357e6545e9525d2))
- do not drop extra packets included in first response ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0ffdb0a31b9b5be8d24d8208521fdd2121cb9a88))

**Release 3.1.0** - 2018-12-14

- initial Engine.IO client implementation
- client examples ([commit](https://github.com/miguelgrinberg/python-engineio/commit/916bd7aa5f8df3a3caf7611133ff82cd2d0cdda7))
- pass custom headers in client connection requests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6bacd03c9cf997af09f638cbcc9e1add441edc9b))
- restructure async drivers into a subpackage ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4621ff8d6ce8bd2e6dd8381ee9764887970aa056))
- documentation updates ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d014ca534e20ad37c75484ae151e3cec3809c200))

**Release 3.0.0** - 2018-12-01

- ASGI support
- support serving static files in wsgi and asgi middlewares ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0c697591b44f6f849b45cec112e00331bbf537aa))
- refactor wsgi and asgi middlewares ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1f7878536a62f9f5285e0a3ed8a83a9ec379d945))
- minor documentation fixes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/00d713d8094233439e5bb888dd5c3b5ec363a5b1))
- reorganized documentation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/84faa991890f33e8fbb5e5db884674d2dd32b1f3))

**Release 2.3.2** - 2018-10-09

- address potential lock of the service thread ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b702f6f98861e78f8c48f9aaee7b9f941de56d99))
- graceful exit for service task ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2f5cd48f0f574c4cabd63f0b46dd652ff93ffc89))

**Release 2.3.1** - 2018-09-30

- updated requirements file ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2ab69b819bec6bea273b124c91cb2163b13266f3))
- more fixes towards cleaning up abruptly disconnected clients ([commit](https://github.com/miguelgrinberg/python-engineio/commit/759dc5e8a3c4301f68ffe72ac8af8422a4099dad))

**Release 2.3.0** - 2018-09-23

- Actively monitor clients for disconnections ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3f583c88449f88200fa5f484954248bfad517aa8))
- parse integer packets as strings [#75](https://github.com/miguelgrinberg/python-engineio/issues/75) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6735659d5cca69476e8a7e98a16a7529ab63a604))
- missing unit test ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a51feef59da8fb491b50a05adb665e980dd9eaa9))
- add Python 3.7 to build ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d9d617a5c62cab692fda4b9664750787303de411))
- removed unused import ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ff3403f1216d838e1930d2322c66bcf609f790e8))
- Tornado docs ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0ef4fbfeeb188a76095de2631cdef9ab4f01839d))

**Release 2.2.0** - 2018-06-28

- tornado unit tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/cb1fe75cea4573dfe3320e5b415c24aaad51d0a0))
- Tornado 5 support ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e0dc7f16c562869d8b48d63f9ee049a413b2f1a2))

**Release 2.1.1** - 2018-05-12

- support OPTIONS request method in aiohttp and sanic [#70](https://github.com/miguelgrinberg/python-engineio/issues/70) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/27261c7d6563bc5c494e9ff345617a923e17452b))
- More flexible specification of CORS allowed origins Suggested in https://github.com/miguelgrinberg/Flask-SocketIO/issues/697#issuecomment-385203087 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8f3d6ecff45d474da1a407d654d06fd3f8f882a8))

**Release 2.1.0** - 2018-04-27

- basic support for cors allowed headers ([commit](https://github.com/miguelgrinberg/python-engineio/commit/08e3766244b12f704ef20f266f10bdfc7381d43a))
- add pypy3 target to travis builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d11b9dae19bf4a5b74b0f6636072e2527a5b8dfe))
- respond to CORS preflight requests [#630](https://github.com/miguelgrinberg/Flask-SocketIO/issues/630) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/eac1e516589604a6831f47959047050af23ff01b))

**Release 2.0.4** - 2018-03-13

- suppress queue empty errors [#65](https://github.com/miguelgrinberg/python-engineio/issues/65) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/861dd52ca2c4fdd9ee1684f1a24bf7acd698039d))

**Release 2.0.3** - 2018-03-06

- more aiohttp unit test fixes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4fd45b8fb86d287c5ba47e7a74cdfb25fa4acb6a))
- fix aiohttp unit test ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4b3ee9309e0250d428fb2faabbb2aa15d377db12))
- support for aiohttp 3.x ([commit](https://github.com/miguelgrinberg/python-engineio/commit/810e759762dd24afa108c8b714fffdced49d3cc1))

**Release 2.0.2** - 2018-01-04

- fix documentation builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/107b751f16aafff5842894a6eff26eb6f784ea5c))
- Suppress "socket is closed" stack trace from logs [#57](https://github.com/miguelgrinberg/python-engineio/issues/57) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7dfc60e91f076e4a70a771cf98f16ceaa3de077c))
- Reraise exceptions in a Py2/Py3 compatible way [#58](https://github.com/miguelgrinberg/python-engineio/issues/58) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4a3320051aac532918b1e0448aad8cc8da615697))

**Release 2.0.1** - 2017-11-21

- Fixed poll() method to always empty the queue [#589](https://github.com/miguelgrinberg/Flask-SocketIO/issues/589) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e8e665b1737987a2b7c59cd6a96464842b864bad))

**Release 2.0.0** - 2017-11-19

- remove double-utf8 encoding hack this hack that made some incorrectly encoded packets sent by the JS socket.io 1.x clients does not always work, and is not needed anymore since the 2.x clients have been fixed. ([commit](https://github.com/miguelgrinberg/python-engineio/commit/83d2277de727e418b0abd1b1115a15307835d582))
- Documented protocol defaults ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e6985ccfa9001aebfa31007dcae70989f2a4792f))

**Release 1.7.0** - 2017-07-02

- cleaner disconnecting of polling clients ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8d541fa2eb2f464b659baf0904de37567120f4bc))
- Support async_handlers option for the asyncio server [#95](https://github.com/miguelgrinberg/python-socketio/issues/95) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6609416d2a0c7b8e750dcf1634f8a4218f5360e9))

**Release 1.6.1** - 2017-06-27

- Tolerate errors when cleaning up a task cancellation [#110](https://github.com/miguelgrinberg/python-engineio/issues/110) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a504e6b53fbb963c817755e57164ba07621aa253))

**Release 1.6.0** - 2017-06-23

- better error handling strategy [#49](https://github.com/miguelgrinberg/python-engineio/issues/49) (again and hopefully better) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8cc004a4a8014924dd822ca14ecabdad4e858c0d))
- Reraise app exceptions with the correct traceback [#49](https://github.com/miguelgrinberg/python-engineio/issues/49) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/66b8f5d63d9583ea1cbd3bb0eb9b4db8f8047ce5))

**Release 1.5.4** - 2017-05-30

- Workaround to prevent the "exception never retrieved" asyncio bug [#48](https://github.com/miguelgrinberg/python-engineio/issues/48) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/dab2d2e9fd33896bbbb772b18323574ddc1b8ce5))

**Release 1.5.3** - 2017-05-29

- Handle buggy and correct encodings for engine.io unicode packets [#102](https://github.com/miguelgrinberg/python-socketio/issues/102) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/efc341ab321209007bddd75333c48d4e74527d53))

**Release 1.5.2** - 2017-05-16

- be a bit more forgiving with socket timeouts ([commit](https://github.com/miguelgrinberg/python-engineio/commit/05da51a41d4a1a7a08e5f19194a248923780fff8))

**Release 1.5.1** - 2017-05-09

- fixed typo ([commit](https://github.com/miguelgrinberg/python-engineio/commit/30445b239227daf88290a972349ba01cd31bd525))

**Release 1.5.0** - 2017-05-09

- another fix in the lost connection detection logic ([commit](https://github.com/miguelgrinberg/python-engineio/commit/73ac2ea7791b79a01974a1ebdb97104f99c1d7a7))
- detect lost connections (asyncio) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9a96896bbda37613bd8b29ac658427366e5d49be))
- detect lost connections (eventlet/gevent) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e9a3161fdcb7767d77a2370d003f4e74ef3ecd1d))

**Release 1.4.0** - 2017-04-21

- properly handle crashes in connect/disconnect handlers ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5b24410016f334e739690438345782fb5dcece02))
- invoke disconnect handler when websocket handler crashes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f772cf62193e0dcc8be43814c1bfda7b987a2a15))
- invoke disconnect handler when application handler crashes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/246edc3e84bce055284936745023ed4491897a5b))

**Release 1.3.2** - 2017-04-09

- Accept leading and trailing slashes in engineio_path [#83](https://github.com/miguelgrinberg/python-socketio/issues/83) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/924d3cb7a0416f7ccbc2364cc94dd07234f6f894))
- Use custom exceptions for internal errors [#44](https://github.com/miguelgrinberg/python-engineio/issues/44) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/36814a48a58b6fdb996a0eed42e32e927711e182))
- Fix sanic url parsing [#43](https://github.com/miguelgrinberg/python-engineio/issues/43) According to sanic docs, `request.url` already contains query string, so adding it results in data corruption. This fix worked for me. [#42](https://github.com/miguelgrinberg/python-engineio/issues/42) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7dda70cb46a0e782d42c0a175ec61d0b95ebced8)) (thanks **Семён Марьясин**!)
- fixed aiohttp unit test ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2b629096cd26378c6755e4db83286a0f573be477))

**Release 1.3.1** - 2017-03-22

- Do not depends on SERVER_SOFTWARE constant from aiohttp [#86](https://github.com/miguelgrinberg/python-socketio/issues/86) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e1136aa4fda888f8f74135a94fadf8ac739cd6ad))
- proper handling of closed sockets ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2144535e9dfe31a17ce6b9d40012d310b34a8c9a))
- use Python 3.6 for docs build ([commit](https://github.com/miguelgrinberg/python-engineio/commit/52b37e50a816635cc363b4655fa984f4519f64e5))
- release 1.3.0 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/51e620e3d49999c8bfff7afa68f712e1ee95bc44))
- Better handling of close packets from the client [#41](https://github.com/miguelgrinberg/python-engineio/issues/41) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/db988f1c24db10db0a5969b0292834c4ac7b8882))
- rename `async` to `_async` to avoid conflicts [#36](https://github.com/miguelgrinberg/python-engineio/issues/36) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6fcf926ec7ec28a3f97f94ffcc6b665ffbbd6bcc))
- websocket support for sanic ([commit](https://github.com/miguelgrinberg/python-engineio/commit/317472459af6c04d26aa9255c0c8dc71ea81fa53))

**Release 1.2.4** - 2017-03-02

- Use non-blocking reads for uwsgi websocket handles [#417](https://github.com/miguelgrinberg/Flask-SocketIO/issues/417) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4148c9470b8d73fc2b35feeeb2d5048cc52b9250))
- handle unexpected disconnects from uwsgi websocket ([commit](https://github.com/miguelgrinberg/python-engineio/commit/10ebccf6766a85da11fee4447a914ac338401d36))

**Release 1.2.3** - 2017-02-22

- Use correct key name for ACCEPT_ENCODING header [#39](https://github.com/miguelgrinberg/python-engineio/issues/39) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f1df2e4a3595207c9f0e91b67a5131af19c0528f))

**Release 1.2.2** - 2017-02-15

- updated examples readme ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ea9ab79e25a9fbba561782a55aeeb5e76d68137f))
- Fix crash on invalid packet type. Add test [#37](https://github.com/miguelgrinberg/python-engineio/issues/37) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7eacdd98edfbf5ce7b1f0da0c3d2343cdf1cbffe)) (thanks **Dmitry Voronin**!)
- minor updates to sanic examples ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c39a7751c72a90085d2bc88ab2487cb673724ee1))
- sanic examples ([commit](https://github.com/miguelgrinberg/python-engineio/commit/251485dcea260f38136bf27bb7676430f458c4f0))
- sanic support (long-polling only) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b2da2283451d558298cae888b9ef148186830a7e))
- updated documentation logo ([commit](https://github.com/miguelgrinberg/python-engineio/commit/54e7115d35de20581e1328eded902c8d40788084))
- ensure iscoroutinefunction works well for mocks ([commit](https://github.com/miguelgrinberg/python-engineio/commit/917df6f57a32e278ee38ef3c6201c90fdab6d061))
- updated requirement files for examples ([commit](https://github.com/miguelgrinberg/python-engineio/commit/20db20f1764d25f50433e088d1d3486994b24139))

**Release 1.2.1** - 2017-02-11

- various minor improvements for asyncio support ([commit](https://github.com/miguelgrinberg/python-engineio/commit/24131a90d0ca5bfdafec0e02ee11ec433e81d44a))
- Fixed asyncio example code [#35](https://github.com/miguelgrinberg/python-engineio/issues/35) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f86847beaff82054f677a4e18c08fb5056b61a78))

**Release 1.2.0** - 2017-02-09

- minor documentation updates ([commit](https://github.com/miguelgrinberg/python-engineio/commit/af2834dd7fb75c579b8e00d155649ce7c71528a1))
- async socket unit tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c19c4477377fe0126a6dda8937414f669dc137f9))
- more asyncio unit tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/039eb59b021ae59347be6a5614709756b915a5d0))
- catch cancelled tasks due to client leaving ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3abadf1962ef433eb62c83d43522a8d636738fde))
- some initial async server unit tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5796794ef2d12823f7306d3cf890fac1290da798))
- asyncio documentation ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d1789caa27e509dcdc0cf76c665f5adab4ad1e41))
- reorganized examples ([commit](https://github.com/miguelgrinberg/python-engineio/commit/824cdd541103f2d52e68848c8cacb2dc4df23c11))
- Preliminary asyncio support! Yay! ([commit](https://github.com/miguelgrinberg/python-engineio/commit/cbeb025e808e9935fb979a042f5884c9ab1a4241))

**Release 1.1.2** - 2017-01-30

- Clean websocket exit for uWSGI [#377](https://github.com/miguelgrinberg/Flask-SocketIO/issues/377) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d15842383b1cd0fbaa741c5125b5ef26d1915a7a))

**Release 1.1.1** - 2017-01-23

- Use text/plain content type for base64 encoded responses [#33](https://github.com/miguelgrinberg/python-engineio/issues/33) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/297ff98e0d9f8f3b32ca5d2afe566a80bb16c6d8))
- removed py33 from tests, added py36 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e0541bcfa069df0f54195a9031630baf7a46c069))
- additional fix regarding bytearray support ([commit](https://github.com/miguelgrinberg/python-engineio/commit/268e3cba424391dd32950d0ba08d28a65c4ef14b))
- Merge branch 'wwqgtxx-patch-1' ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4f25274a0e2e66b2a867b1cdcdf1e820c487e630))
- allow binary packets to be given as bytearrays ([commit](https://github.com/miguelgrinberg/python-engineio/commit/eb8f357082369422464237f47a3c419fb7d14490)) (thanks **wwqgtxx**!)

**Release 1.1.0** - 2016-11-27

- Prevent recursive disconnect handlers [#329](https://github.com/miguelgrinberg/Flask-SocketIO/issues/329) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/84d5800c027fe093db0d7624cbc1e73e176ec221))

**Release 1.0.4** - 2016-11-26

- Use a statically allocated logger by default ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e6b3a6d8bce3d7f53fde7b56037fd9e9f7cbe492))
- fix unit test to work on python 2.7 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/aab2182cea4f4fd3c64b512b443d6f0f3f35a5a9))

**Release 1.0.3** - 2016-09-05

- workaround double utf-8 encode bug in javascript client [#315](https://github.com/socketio/engine.io/issues/315) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/00d2459fcc7d89c7f35a2b3734b339c0fc148b1f))
- upgrade to a more recent engineio.js for the examples ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d61c3ac9d6abd0e0af4518bd6486ec5c218f3ba9))
- do not close a socket that is already closed [#312](https://github.com/miguelgrinberg/Flask-SocketIO/issues/312) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ef20ffcf9abc074493501b284ef2289cfaf6417d))

**Release 1.0.2** - 2016-09-04

- add __version__ to package ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8e1f4e0b3cbfda8d1ac1dcae7102e9f1b3046c88))

**Release 1.0.1** - 2016-09-01

- corrected logic that selects gevent_uwsgi as async mode [#28](https://github.com/miguelgrinberg/python-engineio/issues/28) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/db2fb14a252f0b142525d734bf60f665cb043367))
- documentation fixes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/43fbe9a52e0a36c2cc73cf6e8064c55083c5ad61))

**Release 1.0.0** - 2016-08-26

- updated Server class docstring ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8b5304808bf62cd5215a4e75d1a3c97b07615ec9))
- added async_handlers option to server ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c9133c2392baee13d7e3234d8aebfe550f106131))
- documentation for new gevent_uwsgi async_mode ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3f0b4e3a5cb1f221702b4182c4dda7b91a1fdbd0))
- add unit test for complete code coverage ([commit](https://github.com/miguelgrinberg/python-engineio/commit/36bb48c66b3b54635f55c77cf7b54c9bbc006b84))
- Merge branch 'efficiosoft-uwsgi-gevent-support' ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ad64b54be24e5df17b4e08150693997eb404c0f1))
- Added websocket support for uWSGI with gevent ([commit](https://github.com/miguelgrinberg/python-engineio/commit/8f92f4eba2f94d9388a98fadc38b95611a49056d)) (thanks **Robert Schindler**!)
- minor updates to readme file ([commit](https://github.com/miguelgrinberg/python-engineio/commit/298310af53f1e8bc87468d1b3ed1f146167c090a))

**Release 0.9.2** - 2016-06-28

- minor comment additions to examples ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c85d06ebb3c5414c2b6b28a900e0e6d5f1916dd5))
- async message events, sleep function, better client timeout Several improvements in this commit: 1. Message event handlers are invoked in a thread so that they are non-blocking. 2. Added a sleep function that is generic across async modes. 3. The timeout to declare a client gone has been extended to match the ping timeout setting. ([commit](https://github.com/miguelgrinberg/python-engineio/commit/6670627ea404679fc794b496c21ffce689fc6151))

**Release 0.9.1** - 2016-05-15

- do not crash if recipient of a message is gone ([commit](https://github.com/miguelgrinberg/python-engineio/commit/95c9a55457e9cbd36597b14ad840e31abdb2030e))

**Release 0.9.0** - 2016-03-06

- Correct generation of binary xhr2 packets ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5e5e0a34faa218de32b5bf7a2358d12a3fd6493d))
- Do not write binary packets to the log ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d338ee8787738aab7b7b2fcac9b31127dcb2e9b1))
- Hopefully addressed some tests that fail intermittently on travis ([commit](https://github.com/miguelgrinberg/python-engineio/commit/27bc79f91ad32a90f6f3ea8bd87cead8f4a14f41))

**Release 0.8.8** - 2016-02-21

- Dispose of disconnected sockets ([commit](https://github.com/miguelgrinberg/python-engineio/commit/08c518db6c6dd12d81890cd6239113cfd84e9eec))
- disable imports warning in flake8 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e3badf30f89e4981ed419cf645ccec976370c376))

**Release 0.8.7** - 2016-01-26


**Release 0.8.6** - 2016-01-10

- Graceful failure when websocket is request and the async mode does not support it ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2a5cdf289d2f1af97270f3bbf58669a507aecb9c))

**Release 0.8.5** - 2016-01-02

- additional eventlet unit test ([commit](https://github.com/miguelgrinberg/python-engineio/commit/abd54e58d274355d961ed9272d7b7fda9e3ef9fc))
- Update tests to correspond with flake8 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d1969d6bc016b0e3dc66df7eeb30a9c76debc6b6)) (thanks **Artemiy Rodionov**!)
- Fix eventlet wsgi websocket __call__ return [#12](https://github.com/miguelgrinberg/python-engineio/issues/12) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3f8ecccd40c3f05ef966a6f7e0e2953dc992dfa6)) (thanks **Artemiy Rodionov**!)

**Release 0.8.4** - 2015-12-18

- Revert "_websocket_handler waits on writer even after the socket is closed" [#11](https://github.com/miguelgrinberg/python-engineio/issues/11) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a4ffc8e916aabdc96b0cc7bb5262baf8bd39c661))

**Release 0.8.3** - 2015-12-14

- _websocket_handler waits on writer even after the socket is closed This patch wakes up the writer with a null message when the socket gets closed ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0c439be734b29b1006b7c6d43f1acc6d2260ed9c)) (thanks **Babu Shanmugam**!)

**Release 0.8.2** - 2015-12-13

- Runtime error when websocket is missing from environment ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2ba8a89df6558f088d2cccb541602893929954c0))

**Release 0.8.1** - 2015-12-03

- fix python 3.5 build ([commit](https://github.com/miguelgrinberg/python-engineio/commit/bba8f4bb39634b1523e6932f4b6378251dc0d401))
- tolerate payloads in UPGRADE packet [#7](https://github.com/miguelgrinberg/python-engineio/issues/7) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/0193b5c9935f9dd56e48610499ea6b528cf09582))

**Release 0.8.0** - 2015-11-21

- expose start_background_thread() as a public method ([commit](https://github.com/miguelgrinberg/python-engineio/commit/16aa518d565b7af12c3de07d3416700da5bc99ec))
- Added python 3.5 to the tox build ([commit](https://github.com/miguelgrinberg/python-engineio/commit/5be3c32d2688655891b203aef2d0a31b2b536d6a))

**Release 0.7.2** - 2015-11-04

- Correctly end eventlet's websocket connection See miguelgrinberg/flask-socketio[#167](https://github.com/miguelgrinberg/python-engineio/issues/167) for the problem this fixes. ([commit](https://github.com/miguelgrinberg/python-engineio/commit/fef4b4739d074cebc741d58e099d8b6459e96112))

**Release 0.7.1** - 2015-10-19

- More robust handling of the upgrade exchange ([commit](https://github.com/miguelgrinberg/python-engineio/commit/66b4bc14cb514230799e116a08410e4c3b1deb15))

**Release 0.7.0** - 2015-10-17

- Add kwargs to server constructor ([commit](https://github.com/miguelgrinberg/python-engineio/commit/933ef62fcfd7dedced4b5660084b172181fb4cc9))

**Release 0.6.9** - 2015-10-16

- Give eventlet access to the socket when running under gunicorn ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3c63157f14c2c7443aa2fa8f339bd9afdadb8fa4))

**Release 0.6.8** - 2015-10-07

- Raise a runtime error when gevent-websocket's custom server is not used ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e38cad9d1fb5924db48db4e6632fb756ef6f9767))

**Release 0.6.7** - 2015-09-26

- Better handling of connection state ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c3715e6e6e401d6bc217a99573a8d3b90cf025b1))
- Small improvements to example apps ([commit](https://github.com/miguelgrinberg/python-engineio/commit/48d999d75e60ef2a11f5db6007385046702f50fa))
- Correctly set state of socket connected directly with websocket transport ([commit](https://github.com/miguelgrinberg/python-engineio/commit/86ed25d19fe6f97d7906891172a44f7d0c5fe185))
- Add wrapper to create threads compatible with the selected async mode ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d20c114e6b5bae6d23e756fe4dedb9293d63bdbc))

**Release 0.6.6** - 2015-09-06

- Accept direct websocket connections ([commit](https://github.com/miguelgrinberg/python-engineio/commit/448acfb367c5d9bae464bf7175e77205a970380b))
- Fix executable bit, once again ([commit](https://github.com/miguelgrinberg/python-engineio/commit/fbc018f9a7592f166647ffa4dec3c534769705db))

**Release 0.6.5** - 2015-09-02

- Added transport() method ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f3aeeb51eed439dad82f7fc808a79e6a6718d261))

**Release 0.6.4** - 2015-09-01

- Preserve exception in case it is lost before it is re-reaised ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f0c2f5b444b57c7b80f262e90fcd608cd3af2deb))
- Added a port of the "latency" example from the official Javascript client ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b976ff304e045aa375ec3f9f1f8f17483b2d1934))
- Allow application to provide a custom JSON encoder/decoder. ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1e8fab676f83eab1b82778ab6dcd362609301d57))

**Release 0.6.3** - 2015-08-30

- added b64 unit tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c270acf1da2eb39e12049b86e58287aa9ce0dd71))
- Added b64 checks and encoding during initial connect [#4](https://github.com/miguelgrinberg/python-engineio/issues/4) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/ac90ed68668f617f347c08d0ea4c37ea56ac12c3)) (thanks **Myles Ringle**!)

**Release 0.6.2** - 2015-08-23

- Improved handling of logging ([commit](https://github.com/miguelgrinberg/python-engineio/commit/142b9a66e1e29e5069696a8a2e9757bcb394b268))
- Make gevent websocket optional in example app ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c6b1ae91e2e7c3ee8dfec3caf8a8dfa8c2800aa2))

**Release 0.6.1** - 2015-08-20

- Make gevent thread arguments optional ([commit](https://github.com/miguelgrinberg/python-engineio/commit/3c4f10f266e694380104234294b9ccf2730c1263))

**Release 0.6.0** - 2015-08-20

- Add WebSocket support for gevent (Idea derived from pull request [#1](https://github.com/miguelgrinberg/python-engineio/issues/1) by @drdaeman) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/96dc09b0119a816aada9ad787344ccc912608d55))
- Made parsing of HTTP connection header more robust ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f1ce5e0f5b904e44d587d6dc5aab44800f73cf40))
- Refactored the three async modes as separate modules for greater flexibility (Idea derived from pull request [#1](https://github.com/miguelgrinberg/python-engineio/issues/1) by @drdaeman) ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a85ac4c97e5a5e0d2ecdfd273673b479c0b6c7ff))
- Fix executable bit on several files ([commit](https://github.com/miguelgrinberg/python-engineio/commit/47bc67efc86c3043f4b3c786eea9776a04222e04))

**Release 0.5.1** - 2015-08-17

- Correct handling of CORS origin header ([commit](https://github.com/miguelgrinberg/python-engineio/commit/394a87877e49424461a2c4053e9ce8c216c093b8))
- minor improvements to the example application ([commit](https://github.com/miguelgrinberg/python-engineio/commit/c02a58795bb133f4eb80e7f4d0c64c3a9281c7c3))
- documentation improvements ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f9eaa604d3025aa88a075ab13908ad27ca2b32f1))

**Release 0.5.0** - 2015-08-04

- Support for gevent and threading in addition to eventlet. Also improved example application. ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e72e4883a7301b8dc4bc1128597191d167776331))

**Release 0.4.0** - 2015-08-03

- ensure all HTTP response payloads are returned as bytes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/d38d57f6af139a02adeb5e73f8a3308542ffc3a7))
- Added robustness when dealing with disconnected clients ([commit](https://github.com/miguelgrinberg/python-engineio/commit/7b39dbb6c547ed9dde19f4537e6b3f8e725a4fb6))
- removed assert_called_once from tests ([commit](https://github.com/miguelgrinberg/python-engineio/commit/e6f1b8b7f6c5acb1f37f595cd9696bc5d855c987))
- Added logging for websocket upgrade ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4b5cecab56f4891040f7da04ced523ea50cb8dca))
- Fixed incorrect unit test ([commit](https://github.com/miguelgrinberg/python-engineio/commit/583736a3af266d15c31ee03546f11d018fb97e42))
- rename close() to disconnect() for consistency ([commit](https://github.com/miguelgrinberg/python-engineio/commit/12cc2830374a4848127614f1a21fe8712574219b))

**Release 0.3.1** - 2015-07-04

- Switch README to rst format ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4fb16f8574004ad5b846d81eb9a9d958b448a7da))
- minor documentation and code fixes ([commit](https://github.com/miguelgrinberg/python-engineio/commit/f0e6be6ce16e98f270327a516754ec4d18d7b2f1))

**Release 0.3.0** - 2015-07-04

- Better support for unicode in Python 2 ([commit](https://github.com/miguelgrinberg/python-engineio/commit/9fb200cbf81992cc6cc1cf8f1c9fc15471e5f0f9))
- allow connect event handler to send data to client ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a0dbf69fec47db0bfdca6585267eed21bfc2da91))

**Release 0.2.0** - 2015-06-29

- Added non-decorator format for Server.on() ([commit](https://github.com/miguelgrinberg/python-engineio/commit/2d8d41c514f317e4c2e347030d82c351fbe0fb4e))
- declared vendered js file ([commit](https://github.com/miguelgrinberg/python-engineio/commit/584aba250334fe10949cefbbb99afff89222f024))
- Added pypy to travis builds ([commit](https://github.com/miguelgrinberg/python-engineio/commit/b982ed13d64ece4c76c6af323e2b29db4bdabfdf))
- minor documentation updates ([commit](https://github.com/miguelgrinberg/python-engineio/commit/a25b639ea3e833a28725fd22b36de5b5f6973744))
- Initial commit ([commit](https://github.com/miguelgrinberg/python-engineio/commit/4303b86e4f363e746957e6adecea303089e90f70))
- initial version ([commit](https://github.com/miguelgrinberg/python-engineio/commit/1d53a103ffcc43d1482fecb489d748c1ffaadbe0))


================================================
FILE: LICENSE
================================================
The MIT License (MIT)

Copyright (c) 2015 Miguel Grinberg

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.


================================================
FILE: MANIFEST.in
================================================
include README.md LICENSE tox.ini tests/**/* docs/**/*
exclude **/*.pyc


================================================
FILE: README.md
================================================
python-engineio
===============

[![Build status](https://github.com/miguelgrinberg/python-engineio/workflows/build/badge.svg)](https://github.com/miguelgrinberg/python-engineio/actions) [![codecov](https://codecov.io/gh/miguelgrinberg/python-engineio/branch/main/graph/badge.svg)](https://codecov.io/gh/miguelgrinberg/python-engineio)

Python implementation of the `Engine.IO` realtime client and server.

Sponsors
--------

The following organizations are funding this project:

![Socket.IO](https://images.opencollective.com/socketio/050e5eb/logo/64.png)<br>[Socket.IO](https://socket.io)  | [Add your company here!](https://github.com/sponsors/miguelgrinberg)|
-|-

Many individual sponsors also support this project through small ongoing contributions. Why not [join them](https://github.com/sponsors/miguelgrinberg)?

Resources
---------

-  [Documentation](https://python-engineio.readthedocs.io/)
-  [PyPI](https://pypi.python.org/pypi/python-engineio)
-  [Change Log](https://github.com/miguelgrinberg/python-engineio/blob/main/CHANGES.md)
-  Questions? See the [questions](https://stackoverflow.com/questions/tagged/python-socketio) others have asked on Stack Overflow, or [ask](https://stackoverflow.com/questions/ask?tags=python+python-socketio) your own question.


================================================
FILE: SECURITY.md
================================================
# Security Policy

## Reporting a Vulnerability

If you think you've found a vulnerability on this project, please send me (Miguel Grinberg) an email at mailto:miguel.grinberg@gmail.com with a description of the problem. I will personally review the issue and respond to you with next steps.

If the issue is highly sensitive, you are welcome to encrypt your message. Here is my [PGP key](http://pgp.mit.edu/pks/lookup?search=miguel.grinberg%40gmail.com&op=index).

Please do not disclose vulnerabilities publicly before discussing how to proceed with me.


================================================
FILE: docs/Makefile
================================================
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS    =
SPHINXBUILD   = sphinx-build
SOURCEDIR     = .
BUILDDIR      = _build

# Put it first so that "make" without argument is like "make help".
help:
	@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option.  $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
	@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

================================================
FILE: docs/_static/README.md
================================================
Place static files used by the documentation here.


================================================
FILE: docs/api.rst
================================================
API Reference
=============

.. toctree::
   :maxdepth: 2

   api_client
   api_async_client
   api_server
   api_async_server
   api_wsgiapp
   api_asgiapp
   api_middleware



================================================
FILE: docs/api_asgiapp.rst
================================================
.. autoclass:: engineio.ASGIApp
   :members:



================================================
FILE: docs/api_async_client.rst
================================================
.. autoclass:: engineio.AsyncClient
   :members:
   :inherited-members:



================================================
FILE: docs/api_async_server.rst
================================================
.. autoclass:: engineio.AsyncServer
   :members:
   :inherited-members:



================================================
FILE: docs/api_client.rst
================================================
.. autoclass:: engineio.Client
   :members:
   :inherited-members:



================================================
FILE: docs/api_middleware.rst
================================================
.. autoclass:: engineio.Middleware
   :members:



================================================
FILE: docs/api_server.rst
================================================
.. autoclass:: engineio.Server
   :members:
   :inherited-members:



================================================
FILE: docs/api_wsgiapp.rst
================================================
.. autoclass:: engineio.WSGIApp
   :members:



================================================
FILE: docs/client.rst
================================================
The Engine.IO Client
====================

This package contains two Engine.IO clients:

- The :func:`engineio.Client` class creates a client compatible with the
  standard Python library.
- The :func:`engineio.AsyncClient` class creates a client compatible with
  the ``asyncio`` package.

The methods in the two clients are the same, with the only difference that in
the ``asyncio`` client most methods are implemented as coroutines.

Installation
------------

To install the standard Python client along with its dependencies, use the
following command::

    pip install "python-engineio[client]"

If instead you plan on using the ``asyncio`` client, then use this::

    pip install "python-engineio[asyncio_client]"

Creating a Client Instance
--------------------------

To instantiate an Engine.IO client, simply create an instance of the
appropriate client class::

    import engineio

    # standard Python
    eio = engineio.Client()

    # asyncio
    eio = engineio.AsyncClient()

Defining Event Handlers
-----------------------

To responds to events triggered by the connection or the server, event Handler
functions must be defined using the ``on`` decorator::

    @eio.on('connect')
    def on_connect():
        print('I'm connected!')

    @eio.on('message')
    def on_message(data):
        print('I received a message!')

    @eio.on('disconnect')
    def on_disconnect(reason):
        print('I'm disconnected! reason:', reason)

For the ``asyncio`` server, event handlers can be regular functions as above,
or can also be coroutines::

    @eio.on('message')
    async def on_message(data):
        print('I received a message!')

The argument given to the ``on`` decorator is the event name. The events that
are supported are ``connect``, ``message`` and ``disconnect``.

The ``data`` argument passed to the ``'message'`` event handler contains
application-specific data provided by the server with the event.

The ``disconnect`` handler is invoked for client initiated disconnects, server
initiated disconnects, or accidental disconnects, for example due to
networking failures. The argument passed to this handler provides the
disconnect reason. Example::

    @eio.on('disconnect')
    def on_disconnect(reason):
        if reason == eio.reason.CLIENT_DISCONNECT:
            print('client disconnection')
        elif reason == eio.reason.SERVER_DISCONNECT:
            print('the server kicked me out')
        else:
            print(f'disconnect reason: {reason}')

Connecting to a Server
----------------------

The connection to a server is established by calling the ``connect()``
method::

    eio.connect('http://localhost:5000')

In the case of the ``asyncio`` client, the method is a coroutine::

    await eio.connect('http://localhost:5000')

Upon connection, the server assigns the client a unique session identifier.
The applicaction can find this identifier in the ``sid`` attribute::

    print('my sid is', eio.sid)

Sending Messages
----------------

The client can send a message to the server using the ``send()`` method::

    eio.send({'foo': 'bar'})

Or in the case of ``asyncio``, as a coroutine::

    await eio.send({'foo': 'bar'})

The single argument provided to the method is the data that is passed on
to the server. The data can be of type ``str``, ``bytes``, ``dict`` or
``list``. The data included inside dictionaries and lists is also
constrained to these types.

The ``send()`` method can be invoked inside an event handler as a response
to a server event, or in any other part of the application, including in
background tasks.

Disconnecting from the Server
-----------------------------

At any time the client can request to be disconnected from the server by
invoking the ``disconnect()`` method::

    eio.disconnect()

For the ``asyncio`` client this is a coroutine::

    await eio.disconnect()

Managing Background Tasks
-------------------------

When a client connection to the server is established, a few background
tasks will be spawned to keep the connection alive and handle incoming
events. The application running on the main thread is free to do any
work, as this is not going to prevent the functioning of the Engine.IO
client.

If the application does not have anything to do in the main thread and
just wants to wait until the connection ends, it can call the ``wait()``
method::

    eio.wait()

Or in the ``asyncio`` version::

    await eio.wait()

For the convenience of the application, a helper function is
provided to start a custom background task::

    def my_background_task(my_argument)
        # do some background work here!
        pass

    eio.start_background_task(my_background_task, 123)

The arguments passed to this method are the background function and any
positional or keyword arguments to invoke the function with. 

Here is the ``asyncio`` version::

    async def my_background_task(my_argument)
        # do some background work here!
        pass

    eio.start_background_task(my_background_task, 123)

Note that this function is not a coroutine, since it does not wait for the
background function to end, but the background function is.

The ``sleep()`` method is a second convenience function that is provided for
the benefit of applications working with background tasks of their own::

    eio.sleep(2)

Or for ``asyncio``::

    await eio.sleep(2)

The single argument passed to the method is the number of seconds to sleep
for.

Debugging and Troubleshooting
-----------------------------

To help you debug issues, the client can be configured to output logs to the
terminal::

    import engineio

    # standard Python
    eio = engineio.Client(logger=True)

    # asyncio
    eio = engineio.AsyncClient(logger=True)

The ``logger`` argument controls logging behavior:

* ``True``: Enables log output to ``stderr`` at the ``INFO`` level.
* ``False``: Enables log output to ``stderr`` at the ``ERROR`` level. This is
  the default.
* A ``logging.Logger`` instance: Uses the provided logger without additional
  configuration.

Logging can help identify the cause of connection problems, unexpected
disconnections and other issues.


================================================
FILE: docs/conf.py
================================================
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))


# -- Project information -----------------------------------------------------

project = 'python-engineio'
copyright = '2018, Miguel Grinberg'
author = 'Miguel Grinberg'

# The short X.Y version
version = ''
# The full version, including alpha/beta/rc tags
release = ''


# -- General configuration ---------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
]

autodoc_member_order = 'bysource'

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'

# The master toctree document.
master_doc = 'index'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'furo'
html_title = 'python-engineio'

# Theme options are theme-specific and customize the look and feel of a theme
# further.  For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {
}

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself.  Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'python-engineiodoc'


# -- Options for LaTeX output ------------------------------------------------

latex_elements = {
    # The paper size ('letterpaper' or 'a4paper').
    #
    # 'papersize': 'letterpaper',

    # The font size ('10pt', '11pt' or '12pt').
    #
    # 'pointsize': '10pt',

    # Additional stuff for the LaTeX preamble.
    #
    # 'preamble': '',

    # Latex figure (float) alignment
    #
    # 'figure_align': 'htbp',
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
#  author, documentclass [howto, manual, or own class]).
latex_documents = [
    (master_doc, 'python-engineio.tex', 'python-engineio Documentation',
     'Miguel Grinberg', 'manual'),
]


# -- Options for manual page output ------------------------------------------

# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
    (master_doc, 'python-engineio', 'python-engineio Documentation',
     [author], 1)
]


# -- Options for Texinfo output ----------------------------------------------

# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
#  dir menu entry, description, category)
texinfo_documents = [
    (master_doc, 'python-engineio', 'python-engineio Documentation',
     author, 'python-engineio', 'One line description of project.',
     'Miscellaneous'),
]


# -- Options for Epub output -------------------------------------------------

# Bibliographic Dublin Core info.
epub_title = project

# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''

# A unique identification for the text.
#
# epub_uid = ''

# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']


# -- Extension configuration -------------------------------------------------


================================================
FILE: docs/index.rst
================================================
.. python-engineio documentation master file, created by
   sphinx-quickstart on Sat Nov 24 09:42:25 2018.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

python-engineio
===============

This project implements Python based Engine.IO client and server that can run
standalone or integrated with a variety of Python web frameworks and
applications.

.. toctree::
   :maxdepth: 2

   intro
   client
   server
   api

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`


================================================
FILE: docs/intro.rst
================================================
.. engineio documentation master file, created by
   sphinx-quickstart on Sat Jun 13 23:41:23 2015.
   You can adapt this file completely to your liking, but it should at least
   contain the root `toctree` directive.

Getting Started
===============

What is Engine.IO?
------------------

Engine.IO is a lightweight transport protocol that enables real-time
bidirectional event-based communication between clients (typically, though
not always, web browsers) and a server. The official implementations of the
client and server components are written in JavaScript. This package provides
Python implementations of both, each with standard and ``asyncio`` variants.

The Engine.IO protocol is extremely simple. Once a connection between a client
and a server is established, either side can send "messages" to the other
side. Event handlers provided by the applications on both ends are invoked
when a message is received, or when a connection is established or dropped.

Client Examples
---------------

The example that follows shows a simple Python client::

    import engineio

    eio = engineio.Client()

    @eio.on('connect')
    def on_connect():
        print('connection established')

    @eio.on('message')
    def on_message(data):
        print('message received with ', data)
        eio.send({'response': 'my response'})
    
    @eio.on('disconnect')
    def on_disconnect():
        print('disconnected from server')
    
    eio.connect('http://localhost:5000')
    eio.wait()

And here is a similar client written using the official Engine.IO Javascript
client::

    <script src="/path/to/engine.io.js"></script>
    <script>
        var socket = eio('http://localhost:5000');
        socket.on('open', function() { console.log('connection established'); });
        socket.on('message', function(data) {
            console.log('message received with ' + data);
            socket.send({response: 'my response'});
        });
        socket.on('close', function() { console.log('disconnected from server'); });
    </script>

Client Features
---------------

- Can connect to other Engine.IO complaint servers besides the one in this package.
- Compatible with Python 3.6+.
- Two versions of the client, one for standard Python and another for ``asyncio``.
- Uses an event-based architecture implemented with decorators that hides the
  details of the protocol.
- Implements HTTP long-polling and WebSocket transports.

Server Examples
---------------

The following application is a basic example that uses the Eventlet
asynchronous server::

    import engineio
    import eventlet

    eio = engineio.Server()
    app = engineio.WSGIApp(eio, static_files={
        '/': {'content_type': 'text/html', 'filename': 'index.html'}
    })

    @eio.on('connect')
    def connect(sid, environ):
        print("connect ", sid)

    @eio.on('message')
    def message(sid, data):
        print("message ", data)
        eio.send(sid, 'reply')

    @eio.on('disconnect')
    def disconnect(sid):
        print('disconnect ', sid)

    if __name__ == '__main__':
        eventlet.wsgi.server(eventlet.listen(('', 5000)), app)

Below is a similar application, coded for asyncio and the Uvicorn web server::

    import engineio
    import uvicorn

    eio = engineio.AsyncServer()
    app = engineio.ASGIApp(eio, static_files={
        '/': {'content_type': 'text/html', 'filename': 'index.html'}
    })

    @eio.on('connect')
    def connect(sid, environ):
        print("connect ", sid)

    @eio.on('message')
    async def message(sid, data):
        print("message ", data)
        await eio.send(sid, 'reply')

    @eio.on('disconnect')
    def disconnect(sid):
        print('disconnect ', sid)

    if __name__ == '__main__':
        uvicorn.run('127.0.0.1', 5000)

Server Features
---------------

- Can accept clients running other complaint Engine.IO clients besides the one in this
  package.
- Compatible with Python 3.6+.
- Two versions of the server, one for standard Python and another for ``asyncio``.
- Supports large number of clients even on modest hardware due to being
  asynchronous.
- Can be hosted on any `WSGI <https://wsgi.readthedocs.io/en/latest/index.html>`_ and
  `ASGI <https://asgi.readthedocs.io/en/latest/>`_ web servers includind
  `Gunicorn <https://gunicorn.org/>`_, `Uvicorn <https://github.com/encode/uvicorn>`_,
  `eventlet <http://eventlet.net/>`_ and `gevent <http://gevent.org>`_.
- Can be integrated with WSGI applications written in frameworks such as Flask, Django,
  etc.
- Can be integrated with `aiohttp <http://aiohttp.readthedocs.io/>`_,
  `sanic <http://sanic.readthedocs.io/>`_ and `tornado <http://www.tornadoweb.org/>`_
  ``asyncio`` applications.
- Uses an event-based architecture implemented with decorators that hides the
  details of the protocol.
- Implements HTTP long-polling and WebSocket transports.
- Supports XHR2 and XHR browsers as clients.
- Supports text and binary messages.
- Supports gzip and deflate HTTP compression.
- Configurable CORS responses to avoid cross-origin problems with browsers.


================================================
FILE: docs/make.bat
================================================
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
	set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=.
set BUILDDIR=_build

if "%1" == "" goto help

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
	echo.
	echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
	echo.installed, then set the SPHINXBUILD environment variable to point
	echo.to the full path of the 'sphinx-build' executable. Alternatively you
	echo.may add the Sphinx directory to PATH.
	echo.
	echo.If you don't have Sphinx installed, grab it from
	echo.http://sphinx-doc.org/
	exit /b 1
)

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS%

:end
popd


================================================
FILE: docs/server.rst
================================================
The Engine.IO Server
====================

This package contains two Engine.IO servers:

- The :func:`engineio.Server` class creates a server compatible with the
  standard Python library.
- The :func:`engineio.AsyncServer` class creates a server compatible with
  the ``asyncio`` package.

The methods in the two servers are the same, with the only difference that in
the ``asyncio`` server most methods are implemented as coroutines.

Installation
------------

To install the Python Engine.IO server use the following command::

    pip install "python-engineio"

In addition to the server, you will need to select an asynchronous framework
or server to use along with it. The list of supported packages is covered
in the :ref:`deployment-strategies` section.

Creating a Server Instance
--------------------------

An Engine.IO server is an instance of class :class:`engineio.Server`. This
instance can be transformed into a standard WSGI application by wrapping it
with the :class:`engineio.WSGIApp` class::

   import engineio

   # create a Engine.IO server
   eio = engineio.Server()

   # wrap with a WSGI application
   app = engineio.WSGIApp(eio)

For asyncio based servers, the :class:`engineio.AsyncServer` class provides
the same functionality, but in a coroutine friendly format. If desired, The
:class:`engineio.ASGIApp` class can transform the server into a standard
ASGI application::

    # create a Engine.IO server
    eio = engineio.AsyncServer()

    # wrap with ASGI application
    app = engineio.ASGIApp(eio)

These two wrappers can also act as middlewares, forwarding any traffic that is
not intended to the Engine.IO server to another application. This allows
Engine.IO servers to integrate easily into existing WSGI or ASGI applications::

   from wsgi import app  # a Flask, Django, etc. application
   app = engineio.WSGIApp(eio, app)

Serving Static Files
--------------------

The Engine.IO server can be configured to serve static files to clients. This
is particularly useful to deliver HTML, CSS and JavaScript files to clients
when this package is used without a companion web framework.

Static files are configured with a Python dictionary in which each key/value
pair is a static file mapping rule. In its simplest form, this dictionary has
one or more static file URLs as keys, and the corresponding files in the server
as values::

    static_files = {
        '/': 'latency.html',
        '/static/engine.io.js': 'static/engine.io.js',
        '/static/style.css': 'static/style.css',
    }

With this example configuration, when the server receives a request for ``/``
(the root URL) it will return the contents of the file ``latency.html`` in the
current directory, and will assign a content type based on the file extension,
in this case ``text/html``.

Files with the ``.html``, ``.css``, ``.js``, ``.json``, ``.jpg``, ``.png``,
``.gif`` and ``.txt`` file extensions are automatically recognized and
assigned the correct content type. For files with other file extensions or
with no file extension, the ``application/octet-stream`` content type is used
as a default.

If desired, an explicit content type for a static file can be given as follows::

    static_files = {
        '/': {'filename': 'latency.html', 'content_type': 'text/plain'},
    }

It is also possible to configure an entire directory in a single rule, so that all
the files in it are served as static files::

    static_files = {
        '/static': './public',
    }

In this example any files with URLs starting with ``/static`` will be served
directly from the ``public`` folder in the current directory, so for example,
the URL ``/static/index.html`` will return local file ``./public/index.html``
and the URL ``/static/css/styles.css`` will return local file
``./public/css/styles.css``.

If a URL that ends in a ``/`` is requested, then a default filename of
``index.html`` is appended to it. In the previous example, a request for the
``/static/`` URL would return local file ``./public/index.html``. The default
filename to serve for slash-ending URLs can be set in the static files
dictionary with an empty key::

    static_files = {
        '/static': './public',
        '': 'image.gif',
    }

With this configuration, a request for ``/static/`` would return
local file ``./public/image.gif``. A non-standard content type can also be
specified if needed::

    static_files = {
        '/static': './public',
        '': {'filename': 'image.gif', 'content_type': 'text/plain'},
    }

The static file configuration dictionary is given as the ``static_files``
argument to the ``engineio.WSGIApp`` or ``engineio.ASGIApp`` classes::

    # for standard WSGI applications
    eio = engineio.Server()
    app = engineio.WSGIApp(eio, static_files=static_files)

    # for asyncio-based ASGI applications
    eio = engineio.AsyncServer()
    app = engineio.ASGIApp(eio, static_files=static_files)

The routing precedence in these two classes is as follows:

- First, the path is checked against the Engine.IO path.
- Next, the path is checked against the static file configuration, if present.
- If the path did not match the Engine.IO path or any static file, control is
  passed to the secondary application if configured, else a 404 error is
  returned.

Note: static file serving is intended for development use only, and as such
it lacks important features such as caching. Do not use in a production
environment.

Defining Event Handlers
-----------------------

To responds to events triggered by the connection or the client, event Handler
functions must be defined using the ``on`` decorator::

    @eio.on('connect')
    def on_connect(sid):
        print('A client connected!')

    @eio.on('message')
    def on_message(sid, data):
        print('I received a message!')

    @eio.on('disconnect')
    def on_disconnect(sid, reason):
        print('Client disconnected! reason:', reason)

For the ``asyncio`` server, event handlers can be regular functions as above,
or can also be coroutines::

    @eio.on('message')
    async def on_message(sid, data):
        print('I received a message!')

The argument given to the ``on`` decorator is the event name. The events that
are supported are ``connect``, ``message`` and ``disconnect``.

The ``sid`` argument passed into all the event handlers is a connection
identifier for the client. All the events from a client will use the same
``sid`` value.

The ``connect`` handler is the place where the server can perform
authentication. The value returned by this handler is used to determine if the
connection is accepted or rejected. When the handler does not return any value
(which is the same as returning ``None``) or when it returns ``True`` the
connection is accepted. If the handler returns ``False`` or any JSON
compatible data type (string, integer, list or dictionary) the connection is
rejected. A rejected connection triggers a response with a 401 status code.

The ``data`` argument passed to the ``'message'`` event handler contains
application-specific data provided by the client with the event.

The ``disconnect`` handler is invoked for client initiated disconnects,
server initiated disconnects, or accidental disconnects, for example due to
networking failures. The second argument passed to this handler provides the
disconnect reason. Example::

    @eio.on('disconnect')
    def on_disconnect(sid, reason):
        if reason == eio.reason.CLIENT_DISCONNECT:
            print('the client went away')
        elif reason == eio.reason.SERVER_DISCONNECT:
            print('the client was kicked out')
        else:
            print(f'disconnect reason: {reason}')

Sending Messages
----------------

The server can send a message to any client using the ``send()`` method::

    eio.send(sid, {'foo': 'bar'})

Or in the case of ``asyncio``, as a coroutine::

    await eio.send(sid, {'foo': 'bar'})

The first argument provided to the method is the connection identifier for
the recipient client. The second argument is the data that is passed on
to the server. The data can be of type ``str``, ``bytes``, ``dict`` or
``list``. The data included inside dictionaries and lists is also
constrained to these types.

The ``send()`` method can be invoked inside an event handler as a response
to a client event, or in any other part of the application, including in
background tasks.

User Sessions
-------------

The server can maintain application-specific information in a user session
dedicated to each connected client. Applications can use the user session to
write any details about the user that need to be preserved throughout the life
of the connection, such as usernames or user ids.

The ``save_session()`` and ``get_session()`` methods are used to store and
retrieve information in the user session::

    @eio.on('connect')
    def on_connect(sid, environ):
        username = authenticate_user(environ)
        eio.save_session(sid, {'username': username})

    @eio.on('message')
    def on_message(sid, data):
        session = eio.get_session(sid)
        print('message from ', session['username'])

For the ``asyncio`` server, these methods are coroutines::

    @eio.on('connect')
    async def on_connect(sid, environ):
        username = authenticate_user(environ)
        await eio.save_session(sid, {'username': username})

    @eio.on('message')
    async def on_message(sid, data):
        session = await eio.get_session(sid)
        print('message from ', session['username'])

The session can also be manipulated with the `session()` context manager::

    @eio.on('connect')
    def on_connect(sid, environ):
        username = authenticate_user(environ)
        with eio.session(sid) as session:
            session['username'] = username

    @eio.on('message')
    def on_message(sid, data):
        with eio.session(sid) as session:
            print('message from ', session['username'])

For the ``asyncio`` server, an asynchronous context manager is used::

    @eio.on('connect')
    def on_connect(sid, environ):
        username = authenticate_user(environ)
        async with eio.session(sid) as session:
            session['username'] = username

    @eio.on('message')
    def on_message(sid, data):
        async with eio.session(sid) as session:
            print('message from ', session['username'])

Note: the contents of the user session are destroyed when the client
disconnects.

Disconnecting a Client
----------------------

At any time the server can disconnect a client from the server by invoking the
``disconnect()`` method and passing the ``sid`` value assigned to the client::

    eio.disconnect(sid)

For the ``asyncio`` client this is a coroutine::

    await eio.disconnect(sid)

Managing Background Tasks
-------------------------

For the convenience of the application, a helper function is provided to
start a custom background task::

    def my_background_task(my_argument)
        # do some background work here!
        pass

    eio.start_background_task(my_background_task, 123)

The arguments passed to this method are the background function and any
positional or keyword arguments to invoke the function with. 

Here is the ``asyncio`` version::

    async def my_background_task(my_argument)
        # do some background work here!
        pass

    eio.start_background_task(my_background_task, 123)

Note that this function is not a coroutine, since it does not wait for the
background function to end, but the background function is.

The ``sleep()`` method is a second convenience function that is provided for
the benefit of applications working with background tasks of their own::

    eio.sleep(2)

Or for ``asyncio``::

    await eio.sleep(2)

The single argument passed to the method is the number of seconds to sleep
for.

Debugging and Troubleshooting
-----------------------------

To help you debug issues, the server can be configured to output logs to the
terminal::

    import engineio

    # standard Python
    eio = engineio.Server(logger=True)

    # asyncio
    eio = engineio.AsyncServer(logger=True)

The ``logger`` argument controls logging behavior:

* ``True``: Enables log output to ``stderr`` at the ``INFO`` level.
* ``False``: Enables log output to ``stderr`` at the ``ERROR`` level. This is
  the default.
* A ``logging.Logger`` instance: Uses the provided logger without additional
  configuration.

Logging can help identify the cause of connection problems, 400 responses,
bad performance and other issues.

.. _deployment-strategies:

Deployment Strategies
---------------------

The following sections describe a variety of deployment strategies for
Engine.IO servers.

Uvicorn, Daphne, and other ASGI servers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The ``engineio.ASGIApp`` class is an ASGI compatible application that can
forward Engine.IO traffic to an ``engineio.AsyncServer`` instance::

   eio = engineio.AsyncServer(async_mode='asgi')
   app = engineio.ASGIApp(eio)

If desired, the ``engineio.ASGIApp`` class can forward any traffic that is not
Engine.IO to another ASGI application, making it possible to deploy a standard
ASGI web application and the Engine.IO server as a bundle::

   eio = engineio.AsyncServer(async_mode='asgi')
   app = engineio.ASGIApp(eio, other_app)

The ``ASGIApp`` instance is a fully complaint ASGI instance that can be
deployed with an ASGI compatible web server.

Aiohttp
~~~~~~~

`aiohttp <http://aiohttp.readthedocs.io/>`_ provides a framework with support
for HTTP and WebSocket, based on asyncio.

Instances of class ``engineio.AsyncServer`` will automatically use aiohttp
for asynchronous operations if the library is installed. To request its use
explicitly, the ``async_mode`` option can be given in the constructor::

    eio = engineio.AsyncServer(async_mode='aiohttp')

A server configured for aiohttp must be attached to an existing application::

    app = web.Application()
    eio.attach(app)

The aiohttp application can define regular routes that will coexist with the
Engine.IO server. A typical pattern is to add routes that serve a client
application and any associated static files.

The aiohttp application is then executed in the usual manner::

    if __name__ == '__main__':
        web.run_app(app)

Tornado
~~~~~~~

`Tornado <http://www.tornadoweb.org//>`_ is a web framework with support
for HTTP and WebSocket. Only Tornado version 5 and newer are supported, thanks
to its tight integration with asyncio.

Instances of class ``engineio.AsyncServer`` will automatically use tornado
for asynchronous operations if the library is installed. To request its use
explicitly, the ``async_mode`` option can be given in the constructor::

    eio = engineio.AsyncServer(async_mode='tornado')

A server configured for tornado must include a request handler for
Engine.IO::

    app = tornado.web.Application(
        [
            (r"/engine.io/", engineio.get_tornado_handler(eio)),
        ],
        # ... other application options
    )

The tornado application can define other routes that will coexist with the
Engine.IO server. A typical pattern is to add routes that serve a client
application and any associated static files.

The tornado application is then executed in the usual manner::

    app.listen(port)
    tornado.ioloop.IOLoop.current().start()

Sanic
~~~~~

Note: Due to some backward incompatible changes introduced in recent versions
of Sanic, it is currently recommended that a Sanic application is deployed with
the ASGI integration instead.

`Sanic <http://sanic.readthedocs.io/>`_ is a very efficient asynchronous web
server for Python.

Instances of class ``engineio.AsyncServer`` will automatically use Sanic for
asynchronous operations if the framework is installed. To request its use
explicitly, the ``async_mode`` option can be given in the constructor::

    eio = engineio.AsyncServer(async_mode='sanic')

A server configured for Sanic must be attached to an existing application::

    app = Sanic()
    eio.attach(app)

The Sanic application can define regular routes that will coexist with the
Engine.IO server. A typical pattern is to add routes that serve a client
application and any associated static files to this application.

The Sanic application is then executed in the usual manner::

    if __name__ == '__main__':
        app.run()

It has been reported that the CORS support provided by the Sanic extension
`sanic-cors <https://github.com/ashleysommer/sanic-cors>`_ is incompatible with
this package's own support for this protocol. To disable CORS support in this
package and let Sanic take full control, initialize the server as follows::

    eio = engineio.AsyncServer(async_mode='sanic', cors_allowed_origins=[])

On the Sanic side you will need to enable the `CORS_SUPPORTS_CREDENTIALS`
setting in addition to any other configuration that you use::

    app.config['CORS_SUPPORTS_CREDENTIALS'] = True

Eventlet
~~~~~~~~

`Eventlet <http://eventlet.net/>`_ is a high performance concurrent networking
library for Python 2 and 3 that uses coroutines, enabling code to be written in
the same style used with the blocking standard library functions. An Engine.IO
server deployed with eventlet has access to the long-polling and WebSocket
transports.

Instances of class ``engineio.Server`` will automatically use eventlet for
asynchronous operations if the library is installed. To request its use
explicitly, the ``async_mode`` option can be given in the constructor::

    eio = engineio.Server(async_mode='eventlet')

A server configured for eventlet is deployed as a regular WSGI application
using the provided ``engineio.WSGIApp``::

    app = engineio.WSGIApp(eio)
    import eventlet
    eventlet.wsgi.server(eventlet.listen(('', 8000)), app)

Eventlet with Gunicorn
~~~~~~~~~~~~~~~~~~~~~~

An alternative to running the eventlet WSGI server as above is to use
`gunicorn <gunicorn.org>`_, a fully featured pure Python web server. The
command to launch the application under gunicorn is shown below::

    $ gunicorn -k eventlet -w 1 module:app

Due to limitations in its load balancing algorithm, gunicorn can only be used
with one worker process, so the ``-w 1`` option is required. Note that a
single eventlet worker can handle a large number of concurrent clients.

Another limitation when using gunicorn is that the WebSocket transport is not
available, because this transport it requires extensions to the WSGI standard.

Note: Eventlet provides a ``monkey_patch()`` function that replaces all the
blocking functions in the standard library with equivalent asynchronous
versions. While python-engineio does not require monkey patching, other
libraries such as database drivers are likely to require it.

Gevent
~~~~~~

`Gevent <http://gevent.org>`_ is another asynchronous framework based on
coroutines, very similar to eventlet. An Engine.IO server deployed with
gevent has access to the long-polling and websocket transports.

Instances of class ``engineio.Server`` will automatically use gevent for
asynchronous operations if the library is installed and eventlet is not
installed. To request gevent to be selected explicitly, the ``async_mode``
option can be given in the constructor::

    eio = engineio.Server(async_mode='gevent')

A server configured for gevent is deployed as a regular WSGI application
using the provided ``engineio.WSGIApp``::

    from gevent import pywsgi
    app = engineio.WSGIApp(eio)
    pywsgi.WSGIServer(('', 8000), app).serve_forever()

Gevent with Gunicorn
~~~~~~~~~~~~~~~~~~~~

An alternative to running the gevent WSGI server as above is to use
`gunicorn <gunicorn.org>`_, a fully featured pure Python web server. The
command to launch the application under gunicorn is shown below::

    $ gunicorn -k gevent -w 1 module:app

Same as with eventlet, due to limitations in its load balancing algorithm,
gunicorn can only be used with one worker process, so the ``-w 1`` option is
required. Note that a single gevent worker can handle a large number of
concurrent clients.

Note: Gevent provides a ``monkey_patch()`` function that replaces all the
blocking functions in the standard library with equivalent asynchronous
versions. While python-engineio does not require monkey patching, other
libraries such as database drivers are likely to require it.

uWSGI
~~~~~

When using the uWSGI server in combination with gevent, the Engine.IO server
can take advantage of uWSGI's native WebSocket support.

Instances of class ``engineio.Server`` will automatically use this option for
asynchronous operations if both gevent and uWSGI are installed and eventlet is
not installed. To request this asynchoronous mode explicitly, the
``async_mode`` option can be given in the constructor::

    # gevent with uWSGI
    eio = engineio.Server(async_mode='gevent_uwsgi')

A complete explanation of the configuration and usage of the uWSGI server is
beyond the scope of this documentation. The uWSGI server is a fairly complex
package that provides a large and comprehensive set of options. It must be
compiled with WebSocket and SSL support for the WebSocket transport to be
available. As way of an introduction, the following command starts a uWSGI
server for the ``latency.py`` example on port 5000::

    $ uwsgi --http :5000 --gevent 1000 --http-websockets --master --wsgi-file latency.py --callable app

Standard Threads
~~~~~~~~~~~~~~~~

While not comparable to eventlet and gevent in terms of performance,
the Engine.IO server can also be configured to work with multi-threaded web
servers that use standard Python threads. This is an ideal setup to use with
development servers such as `Werkzeug <http://werkzeug.pocoo.org>`_.

Instances of class ``engineio.Server`` will automatically use the threading
mode if neither eventlet nor gevent are not installed. To request the
threading mode explicitly, the ``async_mode`` option can be given in the
constructor::

    eio = engineio.Server(async_mode='threading')

A server configured for threading is deployed as a regular web application,
using any WSGI complaint multi-threaded server. The example below deploys an
Engine.IO application combined with a Flask web application, using Flask's
development web server based on Werkzeug::

    eio = engineio.Server(async_mode='threading')
    app = Flask(__name__)
    app.wsgi_app = engineio.WSGIApp(eio, app.wsgi_app)

    # ... Engine.IO and Flask handler functions ...

    if __name__ == '__main__':
        app.run()

The example that follows shows how to start an Engine.IO application using
Gunicorn's threaded worker class::

    $ gunicorn -w 1 --threads 100 module:app

With the above configuration the server will be able to handle up to 100
concurrent clients.

When using standard threads, WebSocket is supported through the
`simple-websocket <https://github.com/miguelgrinberg/simple-websocket>`_
package, which must be installed separately. This package provides a
multi-threaded WebSocket server that is compatible with Werkzeug and Gunicorn's
threaded worker. Other multi-threaded web servers are not supported and will
not enable the WebSocket transport.

Scalability Notes
~~~~~~~~~~~~~~~~~

Engine.IO is a stateful protocol, which makes horizontal scaling more
difficult. To deploy a cluster of Engine.IO processes hosted on one or
multiple servers the following conditions must be met:

- Each Engine.IO server process must be able to handle multiple requests
  concurrently. This is required because long-polling clients send two
  requests in parallel. Worker processes that can only handle one request at a
  time are not supported.
- The load balancer must be configured to always forward requests from a client
  to the same process. Load balancers call this *sticky sessions*, or
  *session affinity*.

Cross-Origin Controls
---------------------

For security reasons, this server enforces a same-origin policy by default. In
practical terms, this means the following:

- If an incoming HTTP or WebSocket request includes the ``Origin`` header,
  this header must match the scheme and host of the connection URL. In case
  of a mismatch, a 400 status code response is returned and the connection is
  rejected.
- No restrictions are imposed on incoming requests that do not include the
  ``Origin`` header.

If necessary, the ``cors_allowed_origins`` option can be used to allow other
origins. This argument can be set to a string to set a single allowed origin, or
to a list to allow multiple origins. A special value of ``'*'`` can be used to
instruct the server to allow all origins, but this should be done with care, as
this could make the server vulnerable to Cross-Site Request Forgery (CSRF)
attacks.


================================================
FILE: examples/README.rst
================================================
Engine.IO Examples
==================

This directory contains several example Engine.IO applications. Look in the
`server` directory for Engine.IO servers, and in the `client` directory for
Engine.IO clients.


================================================
FILE: examples/client/README.rst
================================================
Engine.IO Client Examples
=========================

This directory contains several example Engine.IO client applications,
organized by directory:

threads
-------

Examples that use standard Python thread concurrency.

asyncio
-------

Examples that use Python's `asyncio` package for concurrency.

javascript
----------

Examples that use the JavaScript version of Engine.IO for compatibility testing.


================================================
FILE: examples/client/asyncio/README.rst
================================================
Engine.IO Asyncio Examples
==========================

This directory contains example Engine.IO clients that work with the
`asyncio` package of the Python standard library.

simple_client.py
----------------

A basic application in which the client sends messages to the server and the
server responds.

latency_client.py
-----------------

In this application the client sends *ping* messages to the server, which are
responded by the server with a *pong*. The client measures the time it takes
for each of these exchanges.

This is an ideal application to measure the performance of the different
asynchronous modes supported by the Engine.IO server.

Running the Examples
--------------------

These examples work with the server examples of the same name. First run one
of the `simple.py` or `latency.py` versions from the `examples/server`
directory. On another terminal, then start the corresponding client with one
of the following commands::

    $ python simple_client.py

or::

    $ python latency_client.py


================================================
FILE: examples/client/asyncio/latency_client.py
================================================
import asyncio
import time
import engineio

eio = engineio.AsyncClient()
start_timer = None


async def send_ping():
    global start_timer
    start_timer = time.time()
    await eio.send('ping')


@eio.on('connect')
async def on_connect():
    print('connected to server')
    await send_ping()


@eio.on('message')
async def on_message(data):
    latency = time.time() - start_timer
    print(f'latency is {latency * 1000:.2f} ms')
    await eio.sleep(1)
    await send_ping()


async def start_client():
    await eio.connect('http://localhost:5000')
    await eio.wait()


if __name__ == '__main__':
    asyncio.run(start_client())


================================================
FILE: examples/client/asyncio/simple_client.py
================================================
import asyncio
import signal
import engineio

eio = engineio.AsyncClient()
exit_event = asyncio.Event()
original_signal_handler = None


async def send_hello():
    message = 'Hello from client side!'
    while not exit_event.is_set():
        print('sending: ' + 'Hello from client side!')
        await eio.send(message)
        try:
            await asyncio.wait_for(exit_event.wait(), timeout=5)
        except asyncio.TimeoutError:
            pass
    await eio.disconnect()


@eio.on('connect')
def on_connect():
    print('connected to server')
    eio.start_background_task(send_hello)


@eio.on('message')
def on_message(data):
    print('received: ' + str(data))


@eio.on('disconnect')
def on_disconnect(reason):
    print('disconnected from server with reason: ', reason)


def signal_handler(sig, frame):
    exit_event.set()
    print('exiting')
    if callable(original_signal_handler):
        original_signal_handler(sig, frame)


async def start_client():
    await eio.connect('http://localhost:5000')
    await eio.wait()


if __name__ == '__main__':
    original_signal_handler = signal.signal(signal.SIGINT, signal_handler)
    asyncio.run(start_client())


================================================
FILE: examples/client/javascript/README.md
================================================
# eio-latency

This is a JavaScript example intended to be used when testing interoperability with Python.

## Running

First, execute:

```
$ npm install
```

Then execute the client:

```
$ node latency_client
```

A connection will be made to `localhost:5000` (if PORT is set in your environment, then it will use that instead).


================================================
FILE: examples/client/javascript/latency_client.js
================================================
const io = require('engine.io-client')
const port = process.env.PORT || 5000;

const socket = io('http://localhost:' + port);
let last;
function send () {
  last = new Date();
  socket.send('ping');
}

socket.on('open', () => {
  send();
});

socket.on('close', () => {
});

socket.on('message', () => {
  const latency = new Date() - last;
  console.log('latency is ' + latency + ' ms');
  setTimeout(send, 1000);
});


================================================
FILE: examples/client/javascript/package.json
================================================
{
  "name": "eio-latency",
  "version": "0.1.0",
  "dependencies": {
    "enchilada": "0.13.0",
    "engine.io": "^6.6.2",
    "engine.io-client": "^6.6.0",
    "express": "^4.22.1",
    "smoothie": "1.19.0"
  }
}


================================================
FILE: examples/client/threads/README.rst
================================================
Engine.IO Threading Examples
============================

This directory contains example Engine.IO clients that work with the
`threading` package of the Python standard library.

simple_client.py
----------------

A basic application in which the client sends messages to the server and the
server responds.

latency_client.py
-----------------

In this application the client sends *ping* messages to the server, which are
responded by the server with a *pong*. The client measures the time it takes
for each of these exchanges.

This is an ideal application to measure the performance of the different
asynchronous modes supported by the Engine.IO server.

Running the Examples
--------------------

These examples work with the server examples of the same name. First run one
of the `simple.py` or `latency.py` versions from the `examples/server`
directory. On another terminal, then start the corresponding client with one
of the following commands::

    $ python simple_client.py

or::

    $ python latency_client.py


================================================
FILE: examples/client/threads/latency_client.py
================================================
import time
import engineio

eio = engineio.Client()
start_timer = None


def send_ping():
    global start_timer
    start_timer = time.time()
    eio.send('ping')


@eio.on('connect')
def on_connect():
    print('connected to server')
    send_ping()


@eio.on('message')
def on_message(data):
    latency = time.time() - start_timer
    print(f'latency is {latency * 1000:.2f} ms')
    eio.sleep(1)
    send_ping()


if __name__ == '__main__':
    eio.connect('http://localhost:5000')
    eio.wait()


================================================
FILE: examples/client/threads/simple_client.py
================================================
import signal
import threading
import engineio

eio = engineio.Client()
exit_event = threading.Event()
original_signal_handler = None


def send_hello():
    message = 'Hello from client side!'
    while not exit_event.is_set():
        print('sending: ' + 'Hello from client side!')
        eio.send(message)
        exit_event.wait(5)
    eio.disconnect()


@eio.on('connect')
def on_connect():
    print('connected to server')
    eio.start_background_task(send_hello)


@eio.on('message')
def on_message(data):
    print('received: ' + str(data))


@eio.on('disconnect')
def on_disconnect(reason):
    print('disconnected from server with reason: ', reason)


def signal_handler(sig, frame):
    exit_event.set()
    print('exiting')
    if callable(original_signal_handler):
        original_signal_handler(sig, frame)


if __name__ == '__main__':
    original_signal_handler = signal.signal(signal.SIGINT, signal_handler)
    eio.connect('http://localhost:5000')
    eio.wait()


================================================
FILE: examples/server/README.rst
================================================
Engine.IO Server Examples
=========================

This directory contains several example Engine.IO server applications,
organized by directory:

wsgi
----

Examples that are compatible with the WSGI specification.

asgi
----

Examples that are compatible with the ASGI specification.

aiohttp
-------

Examples that are compatible with the aiohttp framework for asyncio.

sanic
-----

Examples that are compatible with the sanic framework for asyncio.


tornado
-------

Examples that are compatible with the Tornado framework.

javascript
----------

Examples that use the JavaScript version of Engine.IO for compatiblity testing.


================================================
FILE: examples/server/aiohttp/README.rst
================================================
Engine.IO Examples
==================

This directory contains example Engine.IO applications that are compatible
with asyncio and the aiohttp framework. These applications require Python 3.5
or later.

simple.py
---------

A basic application in which the client sends messages to the server and the
server responds.

latency.py
----------

A port of the latency application included in the official Engine.IO
Javascript server. In this application the client sends *ping* messages to
the server, which are responded by the server with a *pong*. The client
measures the time it takes for each of these exchanges and plots these in real
time to the page.

This is an ideal application to measure the performance of the different
asynchronous modes supported by the Engine.IO server.

Running the Examples
--------------------

To run these examples, create a virtual environment, install the requirements
and then run::

    $ python simple.py

or::

    $ python latency.py

You can then access the application from your web browser at
``http://localhost:8080``.

================================================
FILE: examples/server/aiohttp/latency.html
================================================
<!doctype html>
<html>
  <head>
    <title>EIO Latency</title>
    <link rel="stylesheet" href="/static/style.css" />
  </head>
  <body>
    <h1>EIO Latency <span id="latency"></span></h1>
    <h2 id="transport">(connecting)</h2>
    <canvas id="chart" height="200"></canvas>

    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/smoothie/1.27.0/smoothie.js"></script>
    <script src="/static/engine.io.js"></script>
    <script>
      // socket
      var socket = eio('http://' + document.domain + ':' + location.port);
      var char = $('chart').get(0);
      socket.on('open', function() {
          if (chart.getContext) {
              render();
              window.onresize = render;
          }
          send();
      });
      socket.on('message', function(data) {
          var latency = new Date - last;
          $('#latency').text(latency + 'ms');
          if (time)
              time.append(+new Date, latency);
          setTimeout(send, 100);
      });
      socket.on('close', function() {
          if (smoothie)
              smoothie.stop();
          $('#transport').text('(disconnected)');
      });

      var last;
      function send() {
          last = new Date;
          socket.send('ping');
          $('#transport').text(socket.transport.name);
      }

      // chart
      var smoothie;
      var time;
      function render() {
          if (smoothie)
              smoothie.stop();
          chart.width = document.body.clientWidth;
          smoothie = new SmoothieChart();
          smoothie.streamTo(chart, 1000);
          time = new TimeSeries();
          smoothie.addTimeSeries(time, {
              strokeStyle: 'rgb(255, 0, 0)',
              fillStyle: 'rgba(255, 0, 0, 0.4)',
              lineWidth: 2
          });
      }
    </script>
  </body>
</html>


================================================
FILE: examples/server/aiohttp/latency.py
================================================
from aiohttp import web

import engineio

eio = engineio.AsyncServer(async_mode='aiohttp')
app = web.Application()
eio.attach(app)


async def index(request):
    with open('latency.html') as f:
        return web.Response(text=f.read(), content_type='text/html')


@eio.on('message')
async def message(sid, data):
    await eio.send(sid, 'pong')


app.router.add_static('/static', 'static')
app.router.add_get('/', index)


if __name__ == '__main__':
    web.run_app(app)


================================================
FILE: examples/server/aiohttp/requirements.txt
================================================
aiohttp==3.13.4
async-timeout==1.1.0
chardet==2.3.0
multidict==2.1.4
python-engineio
six==1.10.0
yarl==0.8.1


================================================
FILE: examples/server/aiohttp/simple.html
================================================
<html>
<head>
<script src="/static/engine.io.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
<script>
  $(document).ready(function() {
      var socket = eio('http://' + document.domain + ':' + location.port);
      socket.on('open', function() {
          $('#log').append("Connected to server.<br>");
      });
      socket.on('message', function(data) {
          $('#log').append("Server says: " + data + "<br>");
      });
      socket.on('close', function() {
          $('#log').append("Server closed the connection.<br>");
      });
      window.setInterval(function() {
          $('#log').append("Sending message to server...<br>");
          socket.send('hello from client side!');
      }, 5000);
  });
</script>
</head>
<body>
<h1>python-engineio example application</h1>
<p id="log"></p>
</body>
</html>


================================================
FILE: examples/server/aiohttp/simple.py
================================================
from aiohttp import web

import engineio

eio = engineio.AsyncServer(async_mode='aiohttp')
app = web.Application()
eio.attach(app)


async def index(request):
    with open('simple.html') as f:
        return web.Response(text=f.read(), content_type='text/html')


@eio.on('connect')
def connect(sid, environ):
    print("connect ", sid)


@eio.on('message')
async def message(sid, data):
    print('message from', sid, data)
    await eio.send(sid, 'Thank you for your message!')


@eio.on('disconnect')
def disconnect(sid, reason):
    print('disconnect ', sid, reason)


app.router.add_static('/static', 'static')
app.router.add_get('/', index)


if __name__ == '__main__':
    web.run_app(app)


================================================
FILE: examples/server/aiohttp/static/engine.io.js
================================================
/*!
 * Engine.IO v4.0.4
 * (c) 2014-2020 Guillermo Rauch
 * Released under the MIT License.
 */
(function webpackUniversalModuleDefinition(root, factory) {
	if(typeof exports === 'object' && typeof module === 'object')
		module.exports = factory();
	else if(typeof define === 'function' && define.amd)
		define([], factory);
	else if(typeof exports === 'object')
		exports["eio"] = factory();
	else
		root["eio"] = factory();
})((() => {
      if (typeof self !== 'undefined') {
          return self;
      } else if (typeof window !== 'undefined') {
          return window;
      } else if (typeof global !== 'undefined') {
          return global;
      } else {
          return Function('return this')();
      }
    })(), function() {
return /******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		if(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ 		}
/******/ 	};
/******/
/******/ 	// define __esModule on exports
/******/ 	__webpack_require__.r = function(exports) {
/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ 		}
/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
/******/ 	};
/******/
/******/ 	// create a fake namespace object
/******/ 	// mode & 1: value is a module id, require it
/******/ 	// mode & 2: merge all properties of value into the ns
/******/ 	// mode & 4: return value when already ns object
/******/ 	// mode & 8|1: behave like require
/******/ 	__webpack_require__.t = function(value, mode) {
/******/ 		if(mode & 1) value = __webpack_require__(value);
/******/ 		if(mode & 8) return value;
/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ 		var ns = Object.create(null);
/******/ 		__webpack_require__.r(ns);
/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ 		return ns;
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "";
/******/
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = "./lib/index.js");
/******/ })
/************************************************************************/
/******/ ({

/***/ "./lib/globalThis.browser.js":
/*!***********************************!*\
  !*** ./lib/globalThis.browser.js ***!
  \***********************************/
/*! no static exports found */
/***/ (function(module, exports) {

eval("module.exports = function () {\n  if (typeof self !== \"undefined\") {\n    return self;\n  } else if (typeof window !== \"undefined\") {\n    return window;\n  } else {\n    return Function(\"return this\")();\n  }\n}();\n\n//# sourceURL=webpack://eio/./lib/globalThis.browser.js?");

/***/ }),

/***/ "./lib/index.js":
/*!**********************!*\
  !*** ./lib/index.js ***!
  \**********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var Socket = __webpack_require__(/*! ./socket */ \"./lib/socket.js\");\n\nmodule.exports = function (uri, opts) {\n  return new Socket(uri, opts);\n};\n/**\n * Expose deps for legacy compatibility\n * and standalone browser access.\n */\n\n\nmodule.exports.Socket = Socket;\nmodule.exports.protocol = Socket.protocol; // this is an int\n\nmodule.exports.Transport = __webpack_require__(/*! ./transport */ \"./lib/transport.js\");\nmodule.exports.transports = __webpack_require__(/*! ./transports/index */ \"./lib/transports/index.js\");\nmodule.exports.parser = __webpack_require__(/*! engine.io-parser */ \"./node_modules/engine.io-parser/lib/index.js\");\n\n//# sourceURL=webpack://eio/./lib/index.js?");

/***/ }),

/***/ "./lib/socket.js":
/*!***********************!*\
  !*** ./lib/socket.js ***!
  \***********************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\n\nfunction _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar transports = __webpack_require__(/*! ./transports/index */ \"./lib/transports/index.js\");\n\nvar Emitter = __webpack_require__(/*! component-emitter */ \"./node_modules/component-emitter/index.js\");\n\nvar debug = __webpack_require__(/*! debug */ \"./node_modules/debug/src/browser.js\")(\"engine.io-client:socket\");\n\nvar parser = __webpack_require__(/*! engine.io-parser */ \"./node_modules/engine.io-parser/lib/index.js\");\n\nvar parseuri = __webpack_require__(/*! parseuri */ \"./node_modules/parseuri/index.js\");\n\nvar parseqs = __webpack_require__(/*! parseqs */ \"./node_modules/parseqs/index.js\");\n\nvar Socket =\n/*#__PURE__*/\nfunction (_Emitter) {\n  _inherits(Socket, _Emitter);\n\n  /**\n   * Socket constructor.\n   *\n   * @param {String|Object} uri or options\n   * @param {Object} options\n   * @api public\n   */\n  function Socket(uri) {\n    var _this;\n\n    var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n    _classCallCheck(this, Socket);\n\n    _this = _possibleConstructorReturn(this, _getPrototypeOf(Socket).call(this));\n\n    if (uri && \"object\" === _typeof(uri)) {\n      opts = uri;\n      uri = null;\n    }\n\n    if (uri) {\n      uri = parseuri(uri);\n      opts.hostname = uri.host;\n      opts.secure = uri.protocol === \"https\" || uri.protocol === \"wss\";\n      opts.port = uri.port;\n      if (uri.query) opts.query = uri.query;\n    } else if (opts.host) {\n      opts.hostname = parseuri(opts.host).host;\n    }\n\n    _this.secure = null != opts.secure ? opts.secure : typeof location !== \"undefined\" && \"https:\" === location.protocol;\n\n    if (opts.hostname && !opts.port) {\n      // if no port is specified manually, use the protocol default\n      opts.port = _this.secure ? \"443\" : \"80\";\n    }\n\n    _this.hostname = opts.hostname || (typeof location !== \"undefined\" ? location.hostname : \"localhost\");\n    _this.port = opts.port || (typeof location !== \"undefined\" && location.port ? location.port : _this.secure ? 443 : 80);\n    _this.transports = opts.transports || [\"polling\", \"websocket\"];\n    _this.readyState = \"\";\n    _this.writeBuffer = [];\n    _this.prevBufferLen = 0;\n    _this.opts = _extends({\n      path: \"/engine.io\",\n      agent: false,\n      withCredentials: false,\n      upgrade: true,\n      jsonp: true,\n      timestampParam: \"t\",\n      policyPort: 843,\n      rememberUpgrade: false,\n      rejectUnauthorized: true,\n      perMessageDeflate: {\n        threshold: 1024\n      },\n      transportOptions: {}\n    }, opts);\n    _this.opts.path = _this.opts.path.replace(/\\/$/, \"\") + \"/\";\n\n    if (typeof _this.opts.query === \"string\") {\n      _this.opts.query = parseqs.decode(_this.opts.query);\n    } // set on handshake\n\n\n    _this.id = null;\n    _this.upgrades = null;\n    _this.pingInterval = null;\n    _this.pingTimeout = null; // set on heartbeat\n\n    _this.pingTimeoutTimer = null;\n\n    _this.open();\n\n    return _this;\n  }\n  /**\n   * Creates transport of the given type.\n   *\n   * @param {String} transport name\n   * @return {Transport}\n   * @api private\n   */\n\n\n  _createClass(Socket, [{\n    key: \"createTransport\",\n    value: function createTransport(name) {\n      debug('creating transport \"%s\"', name);\n      var query = clone(this.opts.query); // append engine.io protocol identifier\n\n      query.EIO = parser.protocol; // transport name\n\n      query.transport = name; // session id if we already have one\n\n      if (this.id) query.sid = this.id;\n\n      var opts = _extends({}, this.opts.transportOptions[name], this.opts, {\n        query: query,\n        socket: this,\n        hostname: this.hostname,\n        secure: this.secure,\n        port: this.port\n      });\n\n      debug(\"options: %j\", opts);\n      return new transports[name](opts);\n    }\n    /**\n     * Initializes transport to use and starts probe.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"open\",\n    value: function open() {\n      var transport;\n\n      if (this.opts.rememberUpgrade && Socket.priorWebsocketSuccess && this.transports.indexOf(\"websocket\") !== -1) {\n        transport = \"websocket\";\n      } else if (0 === this.transports.length) {\n        // Emit error on next tick so it can be listened to\n        var self = this;\n        setTimeout(function () {\n          self.emit(\"error\", \"No transports available\");\n        }, 0);\n        return;\n      } else {\n        transport = this.transports[0];\n      }\n\n      this.readyState = \"opening\"; // Retry with the next transport if the transport is disabled (jsonp: false)\n\n      try {\n        transport = this.createTransport(transport);\n      } catch (e) {\n        debug(\"error while creating transport: %s\", e);\n        this.transports.shift();\n        this.open();\n        return;\n      }\n\n      transport.open();\n      this.setTransport(transport);\n    }\n    /**\n     * Sets the current transport. Disables the existing one (if any).\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"setTransport\",\n    value: function setTransport(transport) {\n      debug(\"setting transport %s\", transport.name);\n      var self = this;\n\n      if (this.transport) {\n        debug(\"clearing existing transport %s\", this.transport.name);\n        this.transport.removeAllListeners();\n      } // set up transport\n\n\n      this.transport = transport; // set up transport listeners\n\n      transport.on(\"drain\", function () {\n        self.onDrain();\n      }).on(\"packet\", function (packet) {\n        self.onPacket(packet);\n      }).on(\"error\", function (e) {\n        self.onError(e);\n      }).on(\"close\", function () {\n        self.onClose(\"transport close\");\n      });\n    }\n    /**\n     * Probes a transport.\n     *\n     * @param {String} transport name\n     * @api private\n     */\n\n  }, {\n    key: \"probe\",\n    value: function probe(name) {\n      debug('probing transport \"%s\"', name);\n      var transport = this.createTransport(name, {\n        probe: 1\n      });\n      var failed = false;\n      var self = this;\n      Socket.priorWebsocketSuccess = false;\n\n      function onTransportOpen() {\n        if (self.onlyBinaryUpgrades) {\n          var upgradeLosesBinary = !this.supportsBinary && self.transport.supportsBinary;\n          failed = failed || upgradeLosesBinary;\n        }\n\n        if (failed) return;\n        debug('probe transport \"%s\" opened', name);\n        transport.send([{\n          type: \"ping\",\n          data: \"probe\"\n        }]);\n        transport.once(\"packet\", function (msg) {\n          if (failed) return;\n\n          if (\"pong\" === msg.type && \"probe\" === msg.data) {\n            debug('probe transport \"%s\" pong', name);\n            self.upgrading = true;\n            self.emit(\"upgrading\", transport);\n            if (!transport) return;\n            Socket.priorWebsocketSuccess = \"websocket\" === transport.name;\n            debug('pausing current transport \"%s\"', self.transport.name);\n            self.transport.pause(function () {\n              if (failed) return;\n              if (\"closed\" === self.readyState) return;\n              debug(\"changing transport and sending upgrade packet\");\n              cleanup();\n              self.setTransport(transport);\n              transport.send([{\n                type: \"upgrade\"\n              }]);\n              self.emit(\"upgrade\", transport);\n              transport = null;\n              self.upgrading = false;\n              self.flush();\n            });\n          } else {\n            debug('probe transport \"%s\" failed', name);\n            var err = new Error(\"probe error\");\n            err.transport = transport.name;\n            self.emit(\"upgradeError\", err);\n          }\n        });\n      }\n\n      function freezeTransport() {\n        if (failed) return; // Any callback called by transport should be ignored since now\n\n        failed = true;\n        cleanup();\n        transport.close();\n        transport = null;\n      } // Handle any error that happens while probing\n\n\n      function onerror(err) {\n        var error = new Error(\"probe error: \" + err);\n        error.transport = transport.name;\n        freezeTransport();\n        debug('probe transport \"%s\" failed because of error: %s', name, err);\n        self.emit(\"upgradeError\", error);\n      }\n\n      function onTransportClose() {\n        onerror(\"transport closed\");\n      } // When the socket is closed while we're probing\n\n\n      function onclose() {\n        onerror(\"socket closed\");\n      } // When the socket is upgraded while we're probing\n\n\n      function onupgrade(to) {\n        if (transport && to.name !== transport.name) {\n          debug('\"%s\" works - aborting \"%s\"', to.name, transport.name);\n          freezeTransport();\n        }\n      } // Remove all listeners on the transport and on self\n\n\n      function cleanup() {\n        transport.removeListener(\"open\", onTransportOpen);\n        transport.removeListener(\"error\", onerror);\n        transport.removeListener(\"close\", onTransportClose);\n        self.removeListener(\"close\", onclose);\n        self.removeListener(\"upgrading\", onupgrade);\n      }\n\n      transport.once(\"open\", onTransportOpen);\n      transport.once(\"error\", onerror);\n      transport.once(\"close\", onTransportClose);\n      this.once(\"close\", onclose);\n      this.once(\"upgrading\", onupgrade);\n      transport.open();\n    }\n    /**\n     * Called when connection is deemed open.\n     *\n     * @api public\n     */\n\n  }, {\n    key: \"onOpen\",\n    value: function onOpen() {\n      debug(\"socket open\");\n      this.readyState = \"open\";\n      Socket.priorWebsocketSuccess = \"websocket\" === this.transport.name;\n      this.emit(\"open\");\n      this.flush(); // we check for `readyState` in case an `open`\n      // listener already closed the socket\n\n      if (\"open\" === this.readyState && this.opts.upgrade && this.transport.pause) {\n        debug(\"starting upgrade probes\");\n        var i = 0;\n        var l = this.upgrades.length;\n\n        for (; i < l; i++) {\n          this.probe(this.upgrades[i]);\n        }\n      }\n    }\n    /**\n     * Handles a packet.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"onPacket\",\n    value: function onPacket(packet) {\n      if (\"opening\" === this.readyState || \"open\" === this.readyState || \"closing\" === this.readyState) {\n        debug('socket receive: type \"%s\", data \"%s\"', packet.type, packet.data);\n        this.emit(\"packet\", packet); // Socket is live - any packet counts\n\n        this.emit(\"heartbeat\");\n\n        switch (packet.type) {\n          case \"open\":\n            this.onHandshake(JSON.parse(packet.data));\n            break;\n\n          case \"ping\":\n            this.resetPingTimeout();\n            this.sendPacket(\"pong\");\n            this.emit(\"pong\");\n            break;\n\n          case \"error\":\n            var err = new Error(\"server error\");\n            err.code = packet.data;\n            this.onError(err);\n            break;\n\n          case \"message\":\n            this.emit(\"data\", packet.data);\n            this.emit(\"message\", packet.data);\n            break;\n        }\n      } else {\n        debug('packet received with socket readyState \"%s\"', this.readyState);\n      }\n    }\n    /**\n     * Called upon handshake completion.\n     *\n     * @param {Object} handshake obj\n     * @api private\n     */\n\n  }, {\n    key: \"onHandshake\",\n    value: function onHandshake(data) {\n      this.emit(\"handshake\", data);\n      this.id = data.sid;\n      this.transport.query.sid = data.sid;\n      this.upgrades = this.filterUpgrades(data.upgrades);\n      this.pingInterval = data.pingInterval;\n      this.pingTimeout = data.pingTimeout;\n      this.onOpen(); // In case open handler closes socket\n\n      if (\"closed\" === this.readyState) return;\n      this.resetPingTimeout();\n    }\n    /**\n     * Sets and resets ping timeout timer based on server pings.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"resetPingTimeout\",\n    value: function resetPingTimeout() {\n      var _this2 = this;\n\n      clearTimeout(this.pingTimeoutTimer);\n      this.pingTimeoutTimer = setTimeout(function () {\n        _this2.onClose(\"ping timeout\");\n      }, this.pingInterval + this.pingTimeout);\n    }\n    /**\n     * Called on `drain` event\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"onDrain\",\n    value: function onDrain() {\n      this.writeBuffer.splice(0, this.prevBufferLen); // setting prevBufferLen = 0 is very important\n      // for example, when upgrading, upgrade packet is sent over,\n      // and a nonzero prevBufferLen could cause problems on `drain`\n\n      this.prevBufferLen = 0;\n\n      if (0 === this.writeBuffer.length) {\n        this.emit(\"drain\");\n      } else {\n        this.flush();\n      }\n    }\n    /**\n     * Flush write buffers.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"flush\",\n    value: function flush() {\n      if (\"closed\" !== this.readyState && this.transport.writable && !this.upgrading && this.writeBuffer.length) {\n        debug(\"flushing %d packets in socket\", this.writeBuffer.length);\n        this.transport.send(this.writeBuffer); // keep track of current length of writeBuffer\n        // splice writeBuffer and callbackBuffer on `drain`\n\n        this.prevBufferLen = this.writeBuffer.length;\n        this.emit(\"flush\");\n      }\n    }\n    /**\n     * Sends a message.\n     *\n     * @param {String} message.\n     * @param {Function} callback function.\n     * @param {Object} options.\n     * @return {Socket} for chaining.\n     * @api public\n     */\n\n  }, {\n    key: \"write\",\n    value: function write(msg, options, fn) {\n      this.sendPacket(\"message\", msg, options, fn);\n      return this;\n    }\n  }, {\n    key: \"send\",\n    value: function send(msg, options, fn) {\n      this.sendPacket(\"message\", msg, options, fn);\n      return this;\n    }\n    /**\n     * Sends a packet.\n     *\n     * @param {String} packet type.\n     * @param {String} data.\n     * @param {Object} options.\n     * @param {Function} callback function.\n     * @api private\n     */\n\n  }, {\n    key: \"sendPacket\",\n    value: function sendPacket(type, data, options, fn) {\n      if (\"function\" === typeof data) {\n        fn = data;\n        data = undefined;\n      }\n\n      if (\"function\" === typeof options) {\n        fn = options;\n        options = null;\n      }\n\n      if (\"closing\" === this.readyState || \"closed\" === this.readyState) {\n        return;\n      }\n\n      options = options || {};\n      options.compress = false !== options.compress;\n      var packet = {\n        type: type,\n        data: data,\n        options: options\n      };\n      this.emit(\"packetCreate\", packet);\n      this.writeBuffer.push(packet);\n      if (fn) this.once(\"flush\", fn);\n      this.flush();\n    }\n    /**\n     * Closes the connection.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"close\",\n    value: function close() {\n      var self = this;\n\n      if (\"opening\" === this.readyState || \"open\" === this.readyState) {\n        this.readyState = \"closing\";\n\n        if (this.writeBuffer.length) {\n          this.once(\"drain\", function () {\n            if (this.upgrading) {\n              waitForUpgrade();\n            } else {\n              close();\n            }\n          });\n        } else if (this.upgrading) {\n          waitForUpgrade();\n        } else {\n          close();\n        }\n      }\n\n      function close() {\n        self.onClose(\"forced close\");\n        debug(\"socket closing - telling transport to close\");\n        self.transport.close();\n      }\n\n      function cleanupAndClose() {\n        self.removeListener(\"upgrade\", cleanupAndClose);\n        self.removeListener(\"upgradeError\", cleanupAndClose);\n        close();\n      }\n\n      function waitForUpgrade() {\n        // wait for upgrade to finish since we can't send packets while pausing a transport\n        self.once(\"upgrade\", cleanupAndClose);\n        self.once(\"upgradeError\", cleanupAndClose);\n      }\n\n      return this;\n    }\n    /**\n     * Called upon transport error\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"onError\",\n    value: function onError(err) {\n      debug(\"socket error %j\", err);\n      Socket.priorWebsocketSuccess = false;\n      this.emit(\"error\", err);\n      this.onClose(\"transport error\", err);\n    }\n    /**\n     * Called upon transport close.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"onClose\",\n    value: function onClose(reason, desc) {\n      if (\"opening\" === this.readyState || \"open\" === this.readyState || \"closing\" === this.readyState) {\n        debug('socket close with reason: \"%s\"', reason);\n        var self = this; // clear timers\n\n        clearTimeout(this.pingIntervalTimer);\n        clearTimeout(this.pingTimeoutTimer); // stop event from firing again for transport\n\n        this.transport.removeAllListeners(\"close\"); // ensure transport won't stay open\n\n        this.transport.close(); // ignore further transport communication\n\n        this.transport.removeAllListeners(); // set ready state\n\n        this.readyState = \"closed\"; // clear session id\n\n        this.id = null; // emit close event\n\n        this.emit(\"close\", reason, desc); // clean buffers after, so users can still\n        // grab the buffers on `close` event\n\n        self.writeBuffer = [];\n        self.prevBufferLen = 0;\n      }\n    }\n    /**\n     * Filters upgrades, returning only those matching client transports.\n     *\n     * @param {Array} server upgrades\n     * @api private\n     *\n     */\n\n  }, {\n    key: \"filterUpgrades\",\n    value: function filterUpgrades(upgrades) {\n      var filteredUpgrades = [];\n      var i = 0;\n      var j = upgrades.length;\n\n      for (; i < j; i++) {\n        if (~this.transports.indexOf(upgrades[i])) filteredUpgrades.push(upgrades[i]);\n      }\n\n      return filteredUpgrades;\n    }\n  }]);\n\n  return Socket;\n}(Emitter);\n\nSocket.priorWebsocketSuccess = false;\n/**\n * Protocol version.\n *\n * @api public\n */\n\nSocket.protocol = parser.protocol; // this is an int\n\nfunction clone(obj) {\n  var o = {};\n\n  for (var i in obj) {\n    if (obj.hasOwnProperty(i)) {\n      o[i] = obj[i];\n    }\n  }\n\n  return o;\n}\n\nmodule.exports = Socket;\n\n//# sourceURL=webpack://eio/./lib/socket.js?");

/***/ }),

/***/ "./lib/transport.js":
/*!**************************!*\
  !*** ./lib/transport.js ***!
  \**************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar parser = __webpack_require__(/*! engine.io-parser */ \"./node_modules/engine.io-parser/lib/index.js\");\n\nvar Emitter = __webpack_require__(/*! component-emitter */ \"./node_modules/component-emitter/index.js\");\n\nvar Transport =\n/*#__PURE__*/\nfunction (_Emitter) {\n  _inherits(Transport, _Emitter);\n\n  /**\n   * Transport abstract constructor.\n   *\n   * @param {Object} options.\n   * @api private\n   */\n  function Transport(opts) {\n    var _this;\n\n    _classCallCheck(this, Transport);\n\n    _this = _possibleConstructorReturn(this, _getPrototypeOf(Transport).call(this));\n    _this.opts = opts;\n    _this.query = opts.query;\n    _this.readyState = \"\";\n    _this.socket = opts.socket;\n    return _this;\n  }\n  /**\n   * Emits an error.\n   *\n   * @param {String} str\n   * @return {Transport} for chaining\n   * @api public\n   */\n\n\n  _createClass(Transport, [{\n    key: \"onError\",\n    value: function onError(msg, desc) {\n      var err = new Error(msg);\n      err.type = \"TransportError\";\n      err.description = desc;\n      this.emit(\"error\", err);\n      return this;\n    }\n    /**\n     * Opens the transport.\n     *\n     * @api public\n     */\n\n  }, {\n    key: \"open\",\n    value: function open() {\n      if (\"closed\" === this.readyState || \"\" === this.readyState) {\n        this.readyState = \"opening\";\n        this.doOpen();\n      }\n\n      return this;\n    }\n    /**\n     * Closes the transport.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"close\",\n    value: function close() {\n      if (\"opening\" === this.readyState || \"open\" === this.readyState) {\n        this.doClose();\n        this.onClose();\n      }\n\n      return this;\n    }\n    /**\n     * Sends multiple packets.\n     *\n     * @param {Array} packets\n     * @api private\n     */\n\n  }, {\n    key: \"send\",\n    value: function send(packets) {\n      if (\"open\" === this.readyState) {\n        this.write(packets);\n      } else {\n        throw new Error(\"Transport not open\");\n      }\n    }\n    /**\n     * Called upon open\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"onOpen\",\n    value: function onOpen() {\n      this.readyState = \"open\";\n      this.writable = true;\n      this.emit(\"open\");\n    }\n    /**\n     * Called with data.\n     *\n     * @param {String} data\n     * @api private\n     */\n\n  }, {\n    key: \"onData\",\n    value: function onData(data) {\n      var packet = parser.decodePacket(data, this.socket.binaryType);\n      this.onPacket(packet);\n    }\n    /**\n     * Called with a decoded packet.\n     */\n\n  }, {\n    key: \"onPacket\",\n    value: function onPacket(packet) {\n      this.emit(\"packet\", packet);\n    }\n    /**\n     * Called upon close.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"onClose\",\n    value: function onClose() {\n      this.readyState = \"closed\";\n      this.emit(\"close\");\n    }\n  }]);\n\n  return Transport;\n}(Emitter);\n\nmodule.exports = Transport;\n\n//# sourceURL=webpack://eio/./lib/transport.js?");

/***/ }),

/***/ "./lib/transports/index.js":
/*!*********************************!*\
  !*** ./lib/transports/index.js ***!
  \*********************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("var XMLHttpRequest = __webpack_require__(/*! xmlhttprequest-ssl */ \"./lib/xmlhttprequest.js\");\n\nvar XHR = __webpack_require__(/*! ./polling-xhr */ \"./lib/transports/polling-xhr.js\");\n\nvar JSONP = __webpack_require__(/*! ./polling-jsonp */ \"./lib/transports/polling-jsonp.js\");\n\nvar websocket = __webpack_require__(/*! ./websocket */ \"./lib/transports/websocket.js\");\n\nexports.polling = polling;\nexports.websocket = websocket;\n/**\n * Polling transport polymorphic constructor.\n * Decides on xhr vs jsonp based on feature detection.\n *\n * @api private\n */\n\nfunction polling(opts) {\n  var xhr;\n  var xd = false;\n  var xs = false;\n  var jsonp = false !== opts.jsonp;\n\n  if (typeof location !== \"undefined\") {\n    var isSSL = \"https:\" === location.protocol;\n    var port = location.port; // some user agents have empty `location.port`\n\n    if (!port) {\n      port = isSSL ? 443 : 80;\n    }\n\n    xd = opts.hostname !== location.hostname || port !== opts.port;\n    xs = opts.secure !== isSSL;\n  }\n\n  opts.xdomain = xd;\n  opts.xscheme = xs;\n  xhr = new XMLHttpRequest(opts);\n\n  if (\"open\" in xhr && !opts.forceJSONP) {\n    return new XHR(opts);\n  } else {\n    if (!jsonp) throw new Error(\"JSONP disabled\");\n    return new JSONP(opts);\n  }\n}\n\n//# sourceURL=webpack://eio/./lib/transports/index.js?");

/***/ }),

/***/ "./lib/transports/polling-jsonp.js":
/*!*****************************************!*\
  !*** ./lib/transports/polling-jsonp.js ***!
  \*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {

eval("function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nvar Polling = __webpack_require__(/*! ./polling */ \"./lib/transports/polling.js\");\n\nvar globalThis = __webpack_require__(/*! ../globalThis */ \"./lib/globalThis.browser.js\");\n\nvar rNewline = /\\n/g;\nvar rEscapedNewline = /\\\\n/g;\n/**\n * Global JSONP callbacks.\n */\n\nvar callbacks;\n/**\n * Noop.\n */\n\nfunction empty() {}\n\nvar JSONPPolling =\n/*#__PURE__*/\nfunction (_Polling) {\n  _inherits(JSONPPolling, _Polling);\n\n  /**\n   * JSONP Polling constructor.\n   *\n   * @param {Object} opts.\n   * @api public\n   */\n  function JSONPPolling(opts) {\n    var _this;\n\n    _classCallCheck(this, JSONPPolling);\n\n    _this = _possibleConstructorReturn(this, _getPrototypeOf(JSONPPolling).call(this, opts));\n    _this.query = _this.query || {}; // define global callbacks array if not present\n    // we do this here (lazily) to avoid unneeded global pollution\n\n    if (!callbacks) {\n      // we need to consider multiple engines in the same page\n      callbacks = globalThis.___eio = globalThis.___eio || [];\n    } // callback identifier\n\n\n    _this.index = callbacks.length; // add callback to jsonp global\n\n    var self = _assertThisInitialized(_this);\n\n    callbacks.push(function (msg) {\n      self.onData(msg);\n    }); // append to query string\n\n    _this.query.j = _this.index; // prevent spurious errors from being emitted when the window is unloaded\n\n    if (typeof addEventListener === \"function\") {\n      addEventListener(\"beforeunload\", function () {\n        if (self.script) self.script.onerror = empty;\n      }, false);\n    }\n\n    return _this;\n  }\n  /**\n   * JSONP only supports binary as base64 encoded strings\n   */\n\n\n  _createClass(JSONPPolling, [{\n    key: \"doClose\",\n\n    /**\n     * Closes the socket.\n     *\n     * @api private\n     */\n    value: function doClose() {\n      if (this.script) {\n        this.script.parentNode.removeChild(this.script);\n        this.script = null;\n      }\n\n      if (this.form) {\n        this.form.parentNode.removeChild(this.form);\n        this.form = null;\n        this.iframe = null;\n      }\n\n      _get(_getPrototypeOf(JSONPPolling.prototype), \"doClose\", this).call(this);\n    }\n    /**\n     * Starts a poll cycle.\n     *\n     * @api private\n     */\n\n  }, {\n    key: \"doPoll\",\n    value: function doPoll() {\n      var self = this;\n      var script = document.createElement(\"script\");\n\n      if (this.script) {\n        this.script.parentNode.removeChild(this.script);\n        this.script = null;\n      }\n\n      script.async = true;\n      script.src = this.uri();\n\n      script.onerror = function (e) {\n        self.onError(\"jsonp poll error\", e);\n      };\n\n      var insertAt = document.getElementsByTagName(\"script\")[0];\n\n      if (insertAt) {\n        insertAt.parentNode.insertBefore(script, insertAt);\n      } else {\n        (document.head || document.body).appendChild(script);\n      }\n\n      this.script = script;\n      var isUAgecko = \"undefined\" !== typeof navigator && /gecko/i.test(navigator.userAgent);\n\n      if (isUAgecko) {\n        setTimeout(function () {\n          var iframe = document.createElement(\"iframe\");\n          document.body.appendChild(iframe);\n          document.body.removeChild(iframe);\n        }, 100);\n      }\n    }\n    /**\n     * Writes with a hidden iframe.\n     *\n     * @param {String} data to send\n     * @param {Function} called upon flush.\n     * @api private\n     */\n\n  }, {\n    key: \"doWrite\",\n    value: function doWrite(data, fn) {\n      var self = this;\n      var iframe;\n\n      if (!this.form) {\n        var form = document.createElement(\"form\");\n        var area = document.createElement(\"textarea\");\n        var id = this.iframeId = \"eio_iframe_\" + this.index;\n        form.className = \"socketio\";\n        form.style.position = \"absolute\";\n        form.style.top = \"-1000px\";\n        form.style.left = \"-1000px\";\n        form.target = id;\n        form.method = \"POST\";\n        form.setAttribute(\"accept-charset\", \"utf-8\");\n        area.name = \"d\";\n        form.appendChild(area);\n        document.body.appendChild(form);\n        this.form = form;\n        this.area = area;\n      }\n\n      this.form.action = this.uri();\n\n      function complete() {\n        initIframe();\n        fn();\n      }\n\n      function initIframe() {\n        if (self.iframe) {\n          try {\n            self.form.removeChild(self.iframe);\n          } catch (e) {\n            self.onError(\"jsonp polling iframe removal error\", e);\n          }\n        }\n\n        try {\n          // ie6 dynamic iframes with target=\"\" support (thanks Chris Lambacher)\n          var html = '<iframe src=\"javascript:0\" name=\"' + self.iframeId + '\">';\n          iframe = document.createElement(html);\n        } catch (e) {\n          iframe = document.createElement(\"iframe\");\n          iframe.name = self.iframeId;\n          iframe.src = \"javascript:0\";\n        }\n\n        iframe.id = self.iframeId;\n        self.form.appendChild(iframe);\n        self.iframe = iframe;\n      }\n\n      initIframe(); // escape \\n to prevent it from being converted into \\r\\n by some UAs\n      // double escaping is required for escaped new lines because unescaping of new lines can be done safely on server-side\n\n      data = data.replace(rEscapedNewline, \"\\\\\\n\");\n      this.area.value = data.replace(rNewline, \"\\\\n\");\n\n      try {\n        this.form.submit();\n      } catch (e) {}\n\n      if (this.iframe.attachEvent) {\n        this.iframe.onreadystatechange = function () {\n          if (self.iframe.readyState === \"complete\") {\n            complete();\n          }\n        };\n      } else {\n        this.iframe.onload = complete;\n      }\n    }\n  }, {\n    key: \"supportsBinary\",\n    get: function get() {\n      return false;\n    }\n  }]);\n\n  return JSONPPolli
Download .txt
gitextract_syw1c215/

├── .gitattributes
├── .github/
│   ├── ISSUE_TEMPLATE/
│   │   ├── bug_report.md
│   │   ├── config.yml
│   │   └── feature_request.md
│   └── workflows/
│       └── tests.yml
├── .gitignore
├── .readthedocs.yaml
├── CHANGES.md
├── LICENSE
├── MANIFEST.in
├── README.md
├── SECURITY.md
├── docs/
│   ├── Makefile
│   ├── _static/
│   │   └── README.md
│   ├── api.rst
│   ├── api_asgiapp.rst
│   ├── api_async_client.rst
│   ├── api_async_server.rst
│   ├── api_client.rst
│   ├── api_middleware.rst
│   ├── api_server.rst
│   ├── api_wsgiapp.rst
│   ├── client.rst
│   ├── conf.py
│   ├── index.rst
│   ├── intro.rst
│   ├── make.bat
│   └── server.rst
├── examples/
│   ├── README.rst
│   ├── client/
│   │   ├── README.rst
│   │   ├── asyncio/
│   │   │   ├── README.rst
│   │   │   ├── latency_client.py
│   │   │   └── simple_client.py
│   │   ├── javascript/
│   │   │   ├── README.md
│   │   │   ├── latency_client.js
│   │   │   └── package.json
│   │   └── threads/
│   │       ├── README.rst
│   │       ├── latency_client.py
│   │       └── simple_client.py
│   └── server/
│       ├── README.rst
│       ├── aiohttp/
│       │   ├── README.rst
│       │   ├── latency.html
│       │   ├── latency.py
│       │   ├── requirements.txt
│       │   ├── simple.html
│       │   ├── simple.py
│       │   └── static/
│       │       ├── engine.io.js
│       │       └── style.css
│       ├── asgi/
│       │   ├── README.rst
│       │   ├── latency.html
│       │   ├── latency.py
│       │   ├── requirements.txt
│       │   ├── simple.html
│       │   ├── simple.py
│       │   └── static/
│       │       ├── engine.io.js
│       │       └── style.css
│       ├── javascript/
│       │   ├── README.md
│       │   ├── index.html
│       │   ├── index.js
│       │   ├── package.json
│       │   └── public/
│       │       ├── index.js
│       │       └── style.css
│       ├── sanic/
│       │   ├── README.rst
│       │   ├── latency.html
│       │   ├── latency.py
│       │   ├── requirements.txt
│       │   ├── simple.html
│       │   ├── simple.py
│       │   └── static/
│       │       ├── engine.io.js
│       │       └── style.css
│       ├── tornado/
│       │   ├── README.rst
│       │   ├── latency.py
│       │   ├── requirements.txt
│       │   ├── simple.py
│       │   ├── static/
│       │   │   ├── engine.io.js
│       │   │   └── style.css
│       │   └── templates/
│       │       ├── latency.html
│       │       └── simple.html
│       └── wsgi/
│           ├── README.rst
│           ├── latency.py
│           ├── requirements.txt
│           ├── simple.py
│           ├── static/
│           │   ├── engine.io.js
│           │   └── style.css
│           └── templates/
│               ├── latency.html
│               └── simple.html
├── pyproject.toml
├── src/
│   └── engineio/
│       ├── __init__.py
│       ├── async_client.py
│       ├── async_drivers/
│       │   ├── __init__.py
│       │   ├── _websocket_wsgi.py
│       │   ├── aiohttp.py
│       │   ├── asgi.py
│       │   ├── eventlet.py
│       │   ├── gevent.py
│       │   ├── gevent_uwsgi.py
│       │   ├── sanic.py
│       │   ├── threading.py
│       │   └── tornado.py
│       ├── async_server.py
│       ├── async_socket.py
│       ├── base_client.py
│       ├── base_server.py
│       ├── base_socket.py
│       ├── client.py
│       ├── exceptions.py
│       ├── json.py
│       ├── middleware.py
│       ├── packet.py
│       ├── payload.py
│       ├── server.py
│       ├── socket.py
│       └── static_files.py
├── tests/
│   ├── __init__.py
│   ├── async/
│   │   ├── __init__.py
│   │   ├── files/
│   │   │   ├── file.txt
│   │   │   └── index.html
│   │   ├── index.html
│   │   ├── test_aiohttp.py
│   │   ├── test_asgi.py
│   │   ├── test_client.py
│   │   ├── test_sanic.py
│   │   ├── test_server.py
│   │   ├── test_socket.py
│   │   └── test_tornado.py
│   ├── common/
│   │   ├── __init__.py
│   │   ├── files/
│   │   │   ├── file.txt
│   │   │   └── index.html
│   │   ├── index.html
│   │   ├── test_client.py
│   │   ├── test_middleware.py
│   │   ├── test_packet.py
│   │   ├── test_payload.py
│   │   ├── test_server.py
│   │   └── test_socket.py
│   └── performance/
│       ├── README.md
│       ├── binary_b64_packet.py
│       ├── binary_packet.py
│       ├── json_packet.py
│       ├── payload.py
│       ├── run.sh
│       ├── server_receive.py
│       └── text_packet.py
└── tox.ini
Download .txt
SYMBOL INDEX (840 symbols across 63 files)

FILE: examples/client/asyncio/latency_client.py
  function send_ping (line 9) | async def send_ping():
  function on_connect (line 16) | async def on_connect():
  function on_message (line 22) | async def on_message(data):
  function start_client (line 29) | async def start_client():

FILE: examples/client/asyncio/simple_client.py
  function send_hello (line 10) | async def send_hello():
  function on_connect (line 23) | def on_connect():
  function on_message (line 29) | def on_message(data):
  function on_disconnect (line 34) | def on_disconnect(reason):
  function signal_handler (line 38) | def signal_handler(sig, frame):
  function start_client (line 45) | async def start_client():

FILE: examples/client/javascript/latency_client.js
  function send (line 6) | function send () {

FILE: examples/client/threads/latency_client.py
  function send_ping (line 8) | def send_ping():
  function on_connect (line 15) | def on_connect():
  function on_message (line 21) | def on_message(data):

FILE: examples/client/threads/simple_client.py
  function send_hello (line 10) | def send_hello():
  function on_connect (line 20) | def on_connect():
  function on_message (line 26) | def on_message(data):
  function on_disconnect (line 31) | def on_disconnect(reason):
  function signal_handler (line 35) | def signal_handler(sig, frame):

FILE: examples/server/aiohttp/latency.py
  function index (line 10) | async def index(request):
  function message (line 16) | async def message(sid, data):

FILE: examples/server/aiohttp/simple.py
  function index (line 10) | async def index(request):
  function connect (line 16) | def connect(sid, environ):
  function message (line 21) | async def message(sid, data):
  function disconnect (line 27) | def disconnect(sid, reason):

FILE: examples/server/aiohttp/static/engine.io.js
  function __webpack_require__ (line 31) | function __webpack_require__(moduleId) {

FILE: examples/server/asgi/latency.py
  function message (line 13) | async def message(sid, data):

FILE: examples/server/asgi/simple.py
  function connect (line 13) | def connect(sid, environ):
  function message (line 18) | async def message(sid, data):
  function disconnect (line 24) | def disconnect(sid, reason):

FILE: examples/server/asgi/static/engine.io.js
  function __webpack_require__ (line 31) | function __webpack_require__(moduleId) {

FILE: examples/server/javascript/public/index.js
  function $ (line 10) | function $ (id) { return document.getElementById(id); }
  function render (line 17) | function render () {
  function send (line 33) | function send () {

FILE: examples/server/sanic/latency.py
  function index (line 12) | async def index(request):
  function message (line 18) | async def message(sid, data):

FILE: examples/server/sanic/simple.py
  function index (line 12) | async def index(request):
  function connect (line 18) | def connect(sid, environ):
  function message (line 23) | async def message(sid, data):
  function disconnect (line 29) | def disconnect(sid, reason):

FILE: examples/server/sanic/static/engine.io.js
  function __webpack_require__ (line 31) | function __webpack_require__(moduleId) {

FILE: examples/server/tornado/latency.py
  class MainHandler (line 15) | class MainHandler(tornado.web.RequestHandler):
    method get (line 16) | def get(self):
  function message (line 21) | async def message(sid, data):
  function main (line 25) | def main():

FILE: examples/server/tornado/simple.py
  class MainHandler (line 15) | class MainHandler(tornado.web.RequestHandler):
    method get (line 16) | def get(self):
  function connect (line 21) | def connect(sid, environ):
  function message (line 26) | async def message(sid, data):
  function disconnect (line 32) | def disconnect(sid, reason):
  function main (line 36) | def main():

FILE: examples/server/tornado/static/engine.io.js
  function __webpack_require__ (line 31) | function __webpack_require__(moduleId) {

FILE: examples/server/wsgi/latency.py
  function index (line 15) | def index():
  function message (line 20) | def message(sid, data):

FILE: examples/server/wsgi/simple.py
  function index (line 15) | def index():
  function connect (line 20) | def connect(sid, environ):
  function message (line 25) | def message(sid, data):
  function disconnect (line 31) | def disconnect(sid, reason):

FILE: examples/server/wsgi/static/engine.io.js
  function __webpack_require__ (line 31) | function __webpack_require__(moduleId) {

FILE: src/engineio/async_client.py
  function async_signal_handler (line 26) | def async_signal_handler():
  class AsyncClient (line 47) | class AsyncClient(base_client.BaseClient):
    method is_asyncio_based (line 85) | def is_asyncio_based(self):
    method connect (line 88) | async def connect(self, url, headers=None, transports=None,
    method wait (line 135) | async def wait(self):
    method send (line 146) | async def send(self, data):
    method disconnect (line 157) | async def disconnect(self, abort=False, reason=None):
    method start_background_task (line 183) | def start_background_task(self, target, *args, **kwargs):
    method sleep (line 197) | async def sleep(self, seconds=0):
    method create_queue (line 204) | def create_queue(self, *args, **kwargs):
    method get_queue_empty_exception (line 208) | def get_queue_empty_exception(self):
    method create_event (line 214) | def create_event(self):
    method _reset (line 218) | async def _reset(self):
    method __del__ (line 230) | def __del__(self):  # pragma: no cover
    method _connect_polling (line 242) | async def _connect_polling(self, url, headers, engineio_path):
    method _connect_websocket (line 302) | async def _connect_websocket(self, url, headers, engineio_path):
    method _receive_packet (line 417) | async def _receive_packet(self, pkt):
    method _send_packet (line 437) | async def _send_packet(self, pkt):
    method _send_request (line 447) | async def _send_request(
    method _trigger_event (line 469) | async def _trigger_event(self, event, *args, **kwargs):
    method _read_loop_polling (line 530) | async def _read_loop_polling(self):
    method _read_loop_websocket (line 572) | async def _read_loop_websocket(self):
    method _write_loop (line 627) | async def _write_loop(self):

FILE: src/engineio/async_drivers/_websocket_wsgi.py
  class SimpleWebSocketWSGI (line 4) | class SimpleWebSocketWSGI:  # pragma: no cover
    method __init__ (line 9) | def __init__(self, handler, server, **kwargs):
    method __call__ (line 13) | def __call__(self, environ, start_response):
    method close (line 20) | def close(self):
    method send (line 24) | def send(self, message):
    method wait (line 30) | def wait(self):

FILE: src/engineio/async_drivers/aiohttp.py
  function create_route (line 7) | def create_route(app, engineio_server, engineio_endpoint):
  function translate_request (line 20) | def translate_request(request):
  function make_response (line 67) | def make_response(status, headers, payload, environ):
  class WebSocket (line 75) | class WebSocket:  # pragma: no cover
    method __init__ (line 80) | def __init__(self, handler, server):
    method __call__ (line 84) | async def __call__(self, environ):
    method close (line 93) | async def close(self):
    method send (line 96) | async def send(self, message):
    method wait (line 106) | async def wait(self):

FILE: src/engineio/async_drivers/asgi.py
  class ASGIApp (line 8) | class ASGIApp:
    method __init__ (line 46) | def __init__(self, engineio_server, other_asgi_app=None,
    method __call__ (line 61) | async def __call__(self, scope, receive, send):
    method serve_static_file (line 79) | async def serve_static_file(self, static_file, receive,
    method lifespan (line 92) | async def lifespan(self, scope, receive, send):
    method not_found (line 123) | async def not_found(self, receive, send):
    method _ensure_trailing_slash (line 131) | def _ensure_trailing_slash(self, path):
  function translate_request (line 137) | async def translate_request(scope, receive, send):
  function make_response (line 221) | async def make_response(status, headers, payload, environ):
  class WebSocket (line 244) | class WebSocket:  # pragma: no cover
    method __init__ (line 249) | def __init__(self, handler, server):
    method __call__ (line 254) | async def __call__(self, environ):
    method close (line 261) | async def close(self):
    method send (line 268) | async def send(self, message):
    method wait (line 279) | async def wait(self):

FILE: src/engineio/async_drivers/eventlet.py
  class EventletThread (line 6) | class EventletThread:  # pragma: no cover
    method __init__ (line 12) | def __init__(self, target, args=None, kwargs=None):
    method start (line 18) | def start(self):
    method join (line 21) | def join(self):
  class WebSocketWSGI (line 26) | class WebSocketWSGI(_WebSocketWSGI):  # pragma: no cover
    method __init__ (line 27) | def __init__(self, handler, server):
    method __call__ (line 36) | def __call__(self, environ, start_response):

FILE: src/engineio/async_drivers/gevent.py
  class Thread (line 13) | class Thread(gevent.Greenlet):  # pragma: no cover
    method __init__ (line 18) | def __init__(self, target, args=[], kwargs={}):
    method _run (line 21) | def _run(self):
  class WebSocketWSGI (line 26) | class WebSocketWSGI(SimpleWebSocketWSGI):  # pragma: no cover
    method __init__ (line 32) | def __init__(self, handler, server):
    method __init__ (line 49) | def __init__(self, handler, server):
    method __call__ (line 52) | def __call__(self, environ, start_response):
    method close (line 66) | def close(self):
    method send (line 69) | def send(self, message):
    method wait (line 72) | def wait(self):
  class WebSocketWSGI (line 43) | class WebSocketWSGI:  # pragma: no cover
    method __init__ (line 32) | def __init__(self, handler, server):
    method __init__ (line 49) | def __init__(self, handler, server):
    method __call__ (line 52) | def __call__(self, environ, start_response):
    method close (line 66) | def close(self):
    method send (line 69) | def send(self, message):
    method wait (line 72) | def wait(self):

FILE: src/engineio/async_drivers/gevent_uwsgi.py
  class Thread (line 9) | class Thread(gevent.Greenlet):  # pragma: no cover
    method __init__ (line 14) | def __init__(self, target, args=[], kwargs={}):
    method _run (line 17) | def _run(self):
  class uWSGIWebSocket (line 21) | class uWSGIWebSocket:  # pragma: no cover
    method __init__ (line 26) | def __init__(self, handler, server):
    method __call__ (line 31) | def __call__(self, environ, start_response):
    method close (line 66) | def close(self):
    method _send (line 73) | def _send(self, msg):
    method _decode_received (line 85) | def _decode_received(self, msg):
    method send (line 97) | def send(self, msg):
    method wait (line 107) | def wait(self):

FILE: src/engineio/async_drivers/sanic.py
  function create_route (line 15) | def create_route(app, engineio_server, engineio_endpoint):  # pragma: no...
  function translate_request (line 31) | def translate_request(request):  # pragma: no cover
  function make_response (line 94) | def make_response(status, headers, payload, environ):  # pragma: no cover
  class WebSocket (line 109) | class WebSocket:  # pragma: no cover
    method __init__ (line 114) | def __init__(self, handler, server):
    method __call__ (line 119) | async def __call__(self, environ):
    method close (line 128) | async def close(self):
    method send (line 131) | async def send(self, message):
    method wait (line 134) | async def wait(self):

FILE: src/engineio/async_drivers/threading.py
  class DaemonThread (line 7) | class DaemonThread(threading.Thread):  # pragma: no cover
    method __init__ (line 8) | def __init__(self, *args, **kwargs):

FILE: src/engineio/async_drivers/tornado.py
  function get_tornado_handler (line 11) | def get_tornado_handler(engineio_server):
  function translate_request (line 64) | def translate_request(handler):
  function make_response (line 129) | def make_response(status, headers, payload, environ):
  class WebSocket (line 146) | class WebSocket:  # pragma: no cover
    method __init__ (line 151) | def __init__(self, handler, server):
    method __call__ (line 155) | async def __call__(self, environ):
    method close (line 160) | async def close(self):
    method send (line 163) | async def send(self, message):
    method wait (line 170) | async def wait(self):

FILE: src/engineio/async_server.py
  class AsyncServer (line 16) | class AsyncServer(base_server.BaseServer):
    method is_asyncio_based (line 85) | def is_asyncio_based(self):
    method async_modes (line 88) | def async_modes(self):
    method attach (line 91) | def attach(self, app, engineio_path='engine.io'):
    method send (line 96) | async def send(self, sid, data):
    method send_packet (line 108) | async def send_packet(self, sid, pkt):
    method get_session (line 124) | async def get_session(self, sid):
    method save_session (line 136) | async def save_session(self, sid, session):
    method session (line 145) | def session(self, sid):
    method disconnect (line 182) | async def disconnect(self, sid=None):
    method handle_request (line 208) | async def handle_request(self, *args, **kwargs):
    method shutdown (line 360) | async def shutdown(self):
    method start_background_task (line 372) | def start_background_task(self, target, *args, **kwargs):
    method sleep (line 387) | async def sleep(self, seconds=0):
    method create_queue (line 399) | def create_queue(self, *args, **kwargs):
    method get_queue_empty_exception (line 409) | def get_queue_empty_exception(self):
    method create_event (line 419) | def create_event(self, *args, **kwargs):
    method _make_response (line 429) | async def _make_response(self, response_dict, environ):
    method _handle_connect (line 444) | async def _handle_connect(self, environ, transport, jsonp_index=None):
    method _trigger_event (line 502) | async def _trigger_event(self, event, *args, **kwargs):
    method _service_task (line 563) | async def _service_task(self):  # pragma: no cover

FILE: src/engineio/async_socket.py
  class AsyncSocket (line 11) | class AsyncSocket(base_socket.BaseSocket):
    method poll (line 12) | async def poll(self):
    method receive (line 35) | async def receive(self, pkt):
    method check_ping_timeout (line 55) | async def check_ping_timeout(self):
    method send (line 71) | async def send(self, pkt):
    method handle_get_request (line 82) | async def handle_get_request(self, environ):
    method handle_post_request (line 105) | async def handle_post_request(self, environ):
    method close (line 116) | async def close(self, wait=True, abort=False, reason=None):
    method schedule_ping (line 130) | def schedule_ping(self):
    method _send_ping (line 133) | async def _send_ping(self):
    method _upgrade_websocket (line 140) | async def _upgrade_websocket(self, environ):
    method _websocket_handler (line 151) | async def _websocket_handler(self, ws):

FILE: src/engineio/base_client.py
  function signal_handler (line 12) | def signal_handler(sig, frame):
  class BaseClient (line 30) | class BaseClient:
    class reason (line 33) | class reason:
    method __init__ (line 42) | def __init__(self, logger=False, json=None, request_timeout=5,
    method is_asyncio_based (line 86) | def is_asyncio_based(self):
    method on (line 89) | def on(self, event, handler=None):
    method transport (line 122) | def transport(self):
    method _reset (line 130) | def _reset(self):
    method _get_engineio_url (line 134) | def _get_engineio_url(self, url, engineio_path, transport):
    method _get_url_timestamp (line 155) | def _get_url_timestamp(self):
    method create_queue (line 161) | def create_queue(self, *args, **kwargs):  # pragma: no cover
    method get_queue_empty_exception (line 165) | def get_queue_empty_exception(self):  # pragma: no cover

FILE: src/engineio/base_server.py
  class BaseServer (line 15) | class BaseServer:
    class reason (line 22) | class reason:
    method __init__ (line 35) | def __init__(self, async_mode=None, ping_interval=25, ping_timeout=20,
    method is_asyncio_based (line 114) | def is_asyncio_based(self):
    method async_modes (line 117) | def async_modes(self):
    method on (line 120) | def on(self, event, handler=None):
    method transport (line 162) | def transport(self, sid):
    method create_queue (line 172) | def create_queue(self, *args, **kwargs):
    method get_queue_empty_exception (line 181) | def get_queue_empty_exception(self):
    method create_event (line 190) | def create_event(self, *args, **kwargs):
    method generate_id (line 199) | def generate_id(self):
    method _generate_sid_cookie (line 206) | def _generate_sid_cookie(self, sid, attributes):
    method _upgrades (line 220) | def _upgrades(self, sid, transport):
    method _get_socket (line 234) | def _get_socket(self, sid):
    method _ok (line 245) | def _ok(self, packets=None, headers=None, jsonp_index=None):
    method _bad_request (line 260) | def _bad_request(self, message=None):
    method _method_not_found (line 269) | def _method_not_found(self):
    method _unauthorized (line 275) | def _unauthorized(self, message=None):
    method _cors_allowed_origins (line 284) | def _cors_allowed_origins(self, environ):
    method _cors_headers (line 319) | def _cors_headers(self, environ):
    method _gzip (line 339) | def _gzip(self, response):
    method _deflate (line 346) | def _deflate(self, response):
    method _log_error_once (line 350) | def _log_error_once(self, message, message_key):

FILE: src/engineio/base_socket.py
  class BaseSocket (line 1) | class BaseSocket:
    method __init__ (line 4) | def __init__(self, server, sid):

FILE: src/engineio/client.py
  class Client (line 27) | class Client(base_client.BaseClient):
    method connect (line 64) | def connect(self, url, headers=None, transports=None,
    method wait (line 99) | def wait(self):
    method send (line 108) | def send(self, data):
    method disconnect (line 117) | def disconnect(self, abort=False, reason=None):
    method start_background_task (line 141) | def start_background_task(self, target, *args, **kwargs):
    method sleep (line 160) | def sleep(self, seconds=0):
    method create_queue (line 164) | def create_queue(self, *args, **kwargs):
    method get_queue_empty_exception (line 168) | def get_queue_empty_exception(self):
    method create_event (line 174) | def create_event(self, *args, **kwargs):
    method _reset (line 178) | def _reset(self):
    method _connect_polling (line 187) | def _connect_polling(self, url, headers, engineio_path):
    method _connect_websocket (line 248) | def _connect_websocket(self, url, headers, engineio_path):
    method _receive_packet (line 416) | def _receive_packet(self, pkt):
    method _send_packet (line 435) | def _send_packet(self, pkt):
    method _send_request (line 445) | def _send_request(
    method _trigger_event (line 460) | def _trigger_event(self, event, *args, **kwargs):
    method _read_loop_polling (line 481) | def _read_loop_polling(self):
    method _read_loop_websocket (line 522) | def _read_loop_websocket(self):
    method _write_loop (line 573) | def _write_loop(self):

FILE: src/engineio/exceptions.py
  class EngineIOError (line 1) | class EngineIOError(Exception):
  class ContentTooLongError (line 5) | class ContentTooLongError(EngineIOError):
  class UnknownPacketError (line 9) | class UnknownPacketError(EngineIOError):
  class QueueEmpty (line 13) | class QueueEmpty(EngineIOError):
  class SocketIsClosedError (line 17) | class SocketIsClosedError(EngineIOError):
  class ConnectionError (line 21) | class ConnectionError(EngineIOError):

FILE: src/engineio/json.py
  function _safe_int (line 7) | def _safe_int(s):
  function loads (line 13) | def loads(*args, **kwargs):

FILE: src/engineio/middleware.py
  class WSGIApp (line 5) | class WSGIApp:
    method __init__ (line 34) | def __init__(self, engineio_app, wsgi_app=None, static_files=None,
    method __call__ (line 45) | def __call__(self, environ, start_response):
    method not_found (line 77) | def not_found(self, start_response):
  class Middleware (line 82) | class Middleware(WSGIApp):
    method __init__ (line 84) | def __init__(self, engineio_app, wsgi_app=None,

FILE: src/engineio/packet.py
  class Packet (line 10) | class Packet:
    method __init__ (line 15) | def __init__(self, packet_type=NOOP, data=None, encoded_packet=None):
    method encode (line 30) | def encode(self, b64=False):
    method decode (line 56) | def decode(self, encoded_packet):

FILE: src/engineio/payload.py
  class Payload (line 6) | class Payload:
    method __init__ (line 10) | def __init__(self, packets=None, encoded_payload=None):
    method encode (line 15) | def encode(self, jsonp_index=None):
    method decode (line 30) | def decode(self, encoded_payload):

FILE: src/engineio/server.py
  class Server (line 12) | class Server(base_server.BaseServer):
    method send (line 84) | def send(self, sid, data):
    method send_packet (line 94) | def send_packet(self, sid, pkt):
    method get_session (line 108) | def get_session(self, sid):
    method save_session (line 121) | def save_session(self, sid, session):
    method session (line 130) | def session(self, sid):
    method disconnect (line 167) | def disconnect(self, sid=None):
    method handle_request (line 188) | def handle_request(self, environ, start_response):
    method shutdown (line 341) | def shutdown(self):
    method start_background_task (line 353) | def start_background_task(self, target, *args, **kwargs):
    method sleep (line 372) | def sleep(self, seconds=0):
    method _handle_connect (line 382) | def _handle_connect(self, environ, start_response, transport,
    method _trigger_event (line 444) | def _trigger_event(self, event, *args, **kwargs):
    method _service_task (line 472) | def _service_task(self):  # pragma: no cover

FILE: src/engineio/socket.py
  class Socket (line 10) | class Socket(base_socket.BaseSocket):
    method poll (line 12) | def poll(self):
    method receive (line 35) | def receive(self, pkt):
    method check_ping_timeout (line 56) | def check_ping_timeout(self):
    method send (line 72) | def send(self, pkt):
    method handle_get_request (line 83) | def handle_get_request(self, environ, start_response):
    method handle_post_request (line 106) | def handle_post_request(self, environ):
    method close (line 117) | def close(self, wait=True, abort=False, reason=None):
    method schedule_ping (line 132) | def schedule_ping(self):
    method _send_ping (line 135) | def _send_ping(self):
    method _upgrade_websocket (line 142) | def _upgrade_websocket(self, environ, start_response):
    method _websocket_handler (line 153) | def _websocket_handler(self, ws):

FILE: src/engineio/static_files.py
  function get_static_file (line 13) | def get_static_file(path, static_files):

FILE: tests/async/test_aiohttp.py
  class TestAiohttp (line 9) | class TestAiohttp:
    method test_create_route (line 10) | def test_create_route(self):
    method test_translate_request (line 17) | def test_translate_request(self):
    method test_make_response (line 59) | def test_make_response(self):

FILE: tests/async/test_asgi.py
  class TestAsgi (line 7) | class TestAsgi:
    method test_create_app (line 8) | async def test_create_app(self):
    method test_engineio_routing (line 20) | async def test_engineio_routing(self):
    method test_other_app_routing (line 73) | async def test_other_app_routing(self):
    method test_other_app_lifespan_routing (line 80) | async def test_other_app_lifespan_routing(self):
    method test_static_file_routing (line 87) | async def test_static_file_routing(self):
    method test_lifespan_startup (line 170) | async def test_lifespan_startup(self):
    method test_lifespan_startup_sync_function (line 181) | async def test_lifespan_startup_sync_function(self):
    method test_lifespan_startup_async_function (line 199) | async def test_lifespan_startup_async_function(self):
    method test_lifespan_startup_function_exception (line 217) | async def test_lifespan_startup_function_exception(self):
    method test_lifespan_shutdown (line 231) | async def test_lifespan_shutdown(self):
    method test_lifespan_shutdown_sync_function (line 241) | async def test_lifespan_shutdown_sync_function(self):
    method test_lifespan_shutdown_async_function (line 258) | async def test_lifespan_shutdown_async_function(self):
    method test_lifespan_shutdown_function_exception (line 275) | async def test_lifespan_shutdown_function_exception(self):
    method test_lifespan_invalid (line 289) | async def test_lifespan_invalid(self):
    method test_not_found (line 300) | async def test_not_found(self):
    method test_translate_request (line 317) | async def test_translate_request(self):
    method test_translate_request_no_query_string (line 358) | async def test_translate_request_no_query_string(self):
    method test_translate_request_with_large_body (line 398) | async def test_translate_request_with_large_body(self):
    method test_translate_websocket_request (line 444) | async def test_translate_websocket_request(self):
    method test_translate_unknown_request (line 465) | async def test_translate_unknown_request(self):
    method test_translate_request_bad_unicode (line 475) | async def test_translate_request_bad_unicode(self):
    method test_make_response (line 499) | async def test_make_response(self):
    method test_make_response_websocket_accept (line 516) | async def test_make_response_websocket_accept(self):
    method test_make_response_websocket_reject (line 528) | async def test_make_response_websocket_reject(self):
    method test_make_response_websocket_reject_no_payload (line 540) | async def test_make_response_websocket_reject_no_payload(self):
    method test_sub_app_routing (line 552) | async def test_sub_app_routing(self):

FILE: tests/async/test_client.py
  class TestAsyncClient (line 18) | class TestAsyncClient:
    method mock_queue (line 19) | def mock_queue(self, client):
    method mock_ws_timeout (line 28) | def mock_ws_timeout(ws_close):
    method test_is_asyncio_based (line 31) | async def test_is_asyncio_based(self):
    method test_already_connected (line 35) | async def test_already_connected(self):
    method test_invalid_transports (line 41) | async def test_invalid_transports(self):
    method test_some_invalid_transports (line 46) | async def test_some_invalid_transports(self):
    method test_connect_polling (line 52) | async def test_connect_polling(self):
    method test_connect_websocket (line 77) | async def test_connect_websocket(self):
    method test_connect_query_string (line 92) | async def test_connect_query_string(self):
    method test_connect_custom_headers (line 100) | async def test_connect_custom_headers(self):
    method test_wait (line 108) | async def test_wait(self):
    method test_wait_no_task (line 119) | async def test_wait_no_task(self):
    method test_send (line 124) | async def test_send(self):
    method test_disconnect_not_connected (line 145) | async def test_disconnect_not_connected(self):
    method test_disconnect_polling (line 153) | async def test_disconnect_polling(self):
    method test_disconnect_websocket (line 170) | async def test_disconnect_websocket(self):
    method test_disconnect_polling_abort (line 187) | async def test_disconnect_polling_abort(self):
    method test_disconnect_websocket_abort (line 201) | async def test_disconnect_websocket_abort(self):
    method test_background_tasks (line 215) | async def test_background_tasks(self):
    method test_sleep (line 225) | async def test_sleep(self):
    method test_create_queue (line 229) | async def test_create_queue(self):
    method test_create_event (line 235) | async def test_create_event(self):
    method test_polling_connection_failed (line 243) | async def test_polling_connection_failed(self, _time):
    method test_polling_connection_404 (line 255) | async def test_polling_connection_404(self):
    method test_polling_connection_404_no_json (line 271) | async def test_polling_connection_404_no_json(self):
    method test_polling_connection_invalid_packet (line 287) | async def test_polling_connection_invalid_packet(self):
    method test_polling_connection_no_open_packet (line 295) | async def test_polling_connection_no_open_packet(self):
    method test_polling_connection_successful (line 317) | async def test_polling_connection_successful(self):
    method test_polling_https_noverify_connection_successful (line 358) | async def test_polling_https_noverify_connection_successful(self):
    method test_polling_connection_with_more_packets (line 399) | async def test_polling_connection_with_more_packets(self):
    method test_polling_connection_upgraded (line 432) | async def test_polling_connection_upgraded(self):
    method test_polling_connection_not_upgraded (line 470) | async def test_polling_connection_not_upgraded(self):
    method test_websocket_connection_failed (line 509) | async def test_websocket_connection_failed(self, _time):
    method test_websocket_connection_extra (line 528) | async def test_websocket_connection_extra(self, _time):
    method test_websocket_upgrade_failed (line 552) | async def test_websocket_upgrade_failed(self, _time):
    method test_websocket_connection_no_open_packet (line 566) | async def test_websocket_connection_no_open_packet(self):
    method test_websocket_connection_successful (line 581) | async def test_websocket_connection_successful(self, _time):
    method test_websocket_https_noverify_connection_successful (line 622) | async def test_websocket_https_noverify_connection_successful(self, _t...
    method test_websocket_connection_with_cookies (line 664) | async def test_websocket_connection_with_cookies(self, _time):
    method test_websocket_connection_with_cookie_header (line 699) | async def test_websocket_connection_with_cookie_header(self, _time):
    method test_websocket_connection_with_cookies_and_headers (line 737) | async def test_websocket_connection_with_cookies_and_headers(self, _ti...
    method test_websocket_upgrade_no_pong (line 776) | async def test_websocket_upgrade_no_pong(self):
    method test_websocket_upgrade_successful (line 808) | async def test_websocket_upgrade_successful(self):
    method test_receive_unknown_packet (line 840) | async def test_receive_unknown_packet(self):
    method test_receive_noop_packet (line 845) | async def test_receive_noop_packet(self):
    method test_receive_ping_packet (line 850) | async def test_receive_ping_packet(self):
    method test_receive_message_packet (line 856) | async def test_receive_message_packet(self):
    method test_receive_close_packet (line 864) | async def test_receive_close_packet(self):
    method test_send_packet_disconnected (line 871) | async def test_send_packet_disconnected(self):
    method test_send_packet (line 878) | async def test_send_packet(self):
    method test_trigger_event_function (line 887) | async def test_trigger_event_function(self):
    method test_trigger_event_coroutine (line 899) | async def test_trigger_event_coroutine(self):
    method test_trigger_event_function_error (line 911) | async def test_trigger_event_function_error(self):
    method test_trigger_event_coroutine_error (line 924) | async def test_trigger_event_coroutine_error(self):
    method test_trigger_event_function_async (line 937) | async def test_trigger_event_function_async(self):
    method test_trigger_event_coroutine_async (line 950) | async def test_trigger_event_coroutine_async(self):
    method test_trigger_event_function_async_error (line 963) | async def test_trigger_event_function_async_error(self):
    method test_trigger_event_coroutine_async_error (line 977) | async def test_trigger_event_coroutine_async_error(self):
    method test_trigger_unknown_event (line 991) | async def test_trigger_unknown_event(self):
    method test_trigger_legacy_disconnect_event (line 997) | async def test_trigger_legacy_disconnect_event(self):
    method test_trigger_legacy_disconnect_event_async (line 1007) | async def test_trigger_legacy_disconnect_event_async(self):
    method test_read_loop_polling_disconnected (line 1017) | async def test_read_loop_polling_disconnected(self):
    method test_read_loop_polling_no_response (line 1027) | async def test_read_loop_polling_no_response(self, _time):
    method test_read_loop_polling_bad_status (line 1048) | async def test_read_loop_polling_bad_status(self, _time):
    method test_read_loop_polling_bad_packet (line 1066) | async def test_read_loop_polling_bad_packet(self, _time):
    method test_read_loop_polling (line 1084) | async def test_read_loop_polling(self):
    method test_read_loop_websocket_disconnected (line 1116) | async def test_read_loop_websocket_disconnected(self):
    method test_read_loop_websocket_timeout (line 1123) | async def test_read_loop_websocket_timeout(self):
    method test_read_loop_websocket_no_response (line 1137) | async def test_read_loop_websocket_no_response(self):
    method test_read_loop_websocket_unexpected_error (line 1153) | async def test_read_loop_websocket_unexpected_error(self):
    method test_read_loop_websocket (line 1167) | async def test_read_loop_websocket(self):
    method test_write_loop_disconnected (line 1188) | async def test_write_loop_disconnected(self):
    method test_write_loop_no_packets (line 1194) | async def test_write_loop_no_packets(self):
    method test_write_loop_empty_queue (line 1205) | async def test_write_loop_empty_queue(self):
    method test_write_loop_polling_one_packet (line 1215) | async def test_write_loop_polling_one_packet(self):
    method test_write_loop_polling_three_packets (line 1245) | async def test_write_loop_polling_three_packets(self):
    method test_write_loop_polling_two_packets_done (line 1285) | async def test_write_loop_polling_two_packets_done(self):
    method test_write_loop_polling_bad_connection (line 1321) | async def test_write_loop_polling_bad_connection(self):
    method test_write_loop_polling_bad_status (line 1348) | async def test_write_loop_polling_bad_status(self):
    method test_write_loop_websocket_one_packet (line 1377) | async def test_write_loop_websocket_one_packet(self):
    method test_write_loop_websocket_three_packets (line 1398) | async def test_write_loop_websocket_three_packets(self):
    method test_write_loop_websocket_one_packet_binary (line 1427) | async def test_write_loop_websocket_one_packet_binary(self):
    method test_write_loop_websocket_bad_connection (line 1445) | async def test_write_loop_websocket_bad_connection(self):
    method test_signal_handler (line 1467) | async def test_signal_handler(self, original_handler):

FILE: tests/async/test_server.py
  class TestAsyncServer (line 18) | class TestAsyncServer:
    method get_async_mock (line 20) | def get_async_mock(environ={'REQUEST_METHOD': 'GET', 'QUERY_STRING': '...
    method _get_mock_socket (line 38) | def _get_mock_socket(self):
    method setup_class (line 53) | def setup_class(cls):
    method teardown_class (line 57) | def teardown_class(cls):
    method setup_method (line 60) | def setup_method(self):
    method teardown_method (line 63) | def teardown_method(self):
    method test_is_asyncio_based (line 67) | async def test_is_asyncio_based(self):
    method test_async_modes (line 71) | async def test_async_modes(self):
    method test_async_mode_aiohttp (line 75) | async def test_async_mode_aiohttp(self):
    method test_async_mode_auto_aiohttp (line 85) | async def test_async_mode_auto_aiohttp(self, import_module):
    method test_async_modes_wsgi (line 90) | async def test_async_modes_wsgi(self):
    method test_attach (line 101) | async def test_attach(self, import_module):
    method test_session (line 114) | async def test_session(self):
    method test_disconnect (line 126) | async def test_disconnect(self):
    method test_disconnect_all (line 135) | async def test_disconnect_all(self):
    method test_jsonp_not_supported (line 150) | async def test_jsonp_not_supported(self, import_module):
    method test_jsonp_index (line 163) | async def test_jsonp_index(self, import_module):
    method test_connect (line 182) | async def test_connect(self, import_module):
    method test_connect_async_request_response_handlers (line 206) | async def test_connect_async_request_response_handlers(
    method test_connect_no_upgrades (line 234) | async def test_connect_no_upgrades(self, import_module):
    method test_connect_bad_eio_version (line 245) | async def test_connect_bad_eio_version(self, import_module):
    method test_connect_custom_ping_times (line 258) | async def test_connect_custom_ping_times(self, import_module):
    method test_connect_bad_poll (line 273) | async def test_connect_bad_poll(self, AsyncSocket, import_module):
    method test_connect_transport_websocket (line 285) | async def test_connect_transport_websocket(self, AsyncSocket,
    method test_http_upgrade_case_insensitive (line 308) | async def test_http_upgrade_case_insensitive(self, AsyncSocket,
    method test_connect_transport_websocket_closed (line 331) | async def test_connect_transport_websocket_closed(
    method test_connect_transport_invalid (line 355) | async def test_connect_transport_invalid(self, import_module):
    method test_connect_transport_websocket_without_upgrade (line 366) | async def test_connect_transport_websocket_without_upgrade(
    method test_connect_cors_headers (line 378) | async def test_connect_cors_headers(self, import_module):
    method test_connect_cors_allowed_origin (line 388) | async def test_connect_cors_allowed_origin(self, import_module):
    method test_connect_cors_allowed_origin_with_callable (line 400) | async def test_connect_cors_allowed_origin_with_callable(
    method test_connect_cors_not_allowed_origin (line 424) | async def test_connect_cors_not_allowed_origin(self, import_module):
    method test_connect_cors_not_allowed_origin_async_response (line 437) | async def test_connect_cors_not_allowed_origin_async_response(
    method test_connect_str_cors_all_origins (line 457) | async def test_connect_str_cors_all_origins(self, import_module):
    method test_connect_list_cors_all_origins (line 470) | async def test_connect_list_cors_all_origins(self, import_module):
    method test_connect_cors_one_origin (line 483) | async def test_connect_cors_one_origin(self, import_module):
    method test_connect_cors_one_origin_not_allowed (line 496) | async def test_connect_cors_one_origin_not_allowed(self, import_module):
    method test_connect_cors_headers_default_origin (line 509) | async def test_connect_cors_headers_default_origin(self, import_module):
    method test_connect_cors_no_credentials (line 527) | async def test_connect_cors_no_credentials(self, import_module):
    method test_connect_cors_options (line 537) | async def test_connect_cors_options(self, import_module):
    method test_connect_cors_disabled (line 552) | async def test_connect_cors_disabled(self, import_module):
    method test_connect_cors_default_no_origin (line 569) | async def test_connect_cors_default_no_origin(self, import_module):
    method test_connect_str_cors_all_no_origin (line 580) | async def test_connect_str_cors_all_no_origin(self, import_module):
    method test_connect_list_cors_all_no_origin (line 591) | async def test_connect_list_cors_all_no_origin(self, import_module):
    method test_connect_cors_disabled_no_origin (line 602) | async def test_connect_cors_disabled_no_origin(self, import_module):
    method test_connect_event (line 613) | async def test_connect_event(self, import_module):
    method test_connect_event_rejects (line 627) | async def test_connect_event_rejects(self, import_module):
    method test_connect_event_rejects_with_message (line 643) | async def test_connect_event_rejects_with_message(self, import_module):
    method test_method_not_found (line 661) | async def test_method_not_found(self, import_module):
    method test_get_request_with_bad_sid (line 672) | async def test_get_request_with_bad_sid(self, import_module):
    method test_get_request_bad_websocket_transport (line 683) | async def test_get_request_bad_websocket_transport(self, import_module):
    method test_get_request_bad_polling_transport (line 696) | async def test_get_request_bad_polling_transport(self, import_module):
    method test_post_request_with_bad_sid (line 709) | async def test_post_request_with_bad_sid(self, import_module):
    method test_send (line 720) | async def test_send(self, import_module):
    method test_send_unknown_socket (line 733) | async def test_send_unknown_socket(self, import_module):
    method test_get_request (line 741) | async def test_get_request(self, import_module):
    method test_get_request_custom_response (line 761) | async def test_get_request_custom_response(self, import_module):
    method test_get_request_closes_socket (line 773) | async def test_get_request_closes_socket(self, import_module):
    method test_get_request_error (line 791) | async def test_get_request_error(self, import_module):
    method test_post_request (line 808) | async def test_post_request(self, import_module):
    method test_post_request_error (line 819) | async def test_post_request_error(self, import_module):
    method _gzip_decompress (line 835) | def _gzip_decompress(b):
    method test_gzip_compression (line 841) | async def test_gzip_compression(self, import_module):
    method test_deflate_compression (line 861) | async def test_deflate_compression(self, import_module):
    method test_gzip_compression_threshold (line 881) | async def test_gzip_compression_threshold(self, import_module):
    method test_compression_disabled (line 904) | async def test_compression_disabled(self, import_module):
    method test_compression_unknown (line 928) | async def test_compression_unknown(self, import_module):
    method test_compression_no_encoding (line 950) | async def test_compression_no_encoding(self, import_module):
    method test_cookie (line 972) | async def test_cookie(self, import_module):
    method test_cookie_dict (line 982) | async def test_cookie_dict(self, import_module):
    method test_no_cookie (line 1002) | async def test_no_cookie(self, import_module):
    method test_logger (line 1012) | async def test_logger(self):
    method test_custom_json (line 1026) | async def test_custom_json(self):
    method test_background_tasks (line 1048) | async def test_background_tasks(self):
    method test_sleep (line 1062) | async def test_sleep(self):
    method test_trigger_event_function (line 1066) | async def test_trigger_event_function(self):
    method test_trigger_event_coroutine (line 1078) | async def test_trigger_event_coroutine(self):
    method test_trigger_event_function_error (line 1090) | async def test_trigger_event_function_error(self):
    method test_trigger_event_coroutine_error (line 1103) | async def test_trigger_event_coroutine_error(self):
    method test_trigger_event_function_async (line 1116) | async def test_trigger_event_function_async(self):
    method test_trigger_event_coroutine_async (line 1129) | async def test_trigger_event_coroutine_async(self):
    method test_trigger_event_function_async_error (line 1142) | async def test_trigger_event_function_async_error(self):
    method test_trigger_event_coroutine_async_error (line 1155) | async def test_trigger_event_coroutine_async_error(self):
    method test_trigger_legacy_disconnect_event (line 1168) | async def test_trigger_legacy_disconnect_event(self):
    method test_trigger_legacy_disconnect_event_async (line 1178) | async def test_trigger_legacy_disconnect_event_async(self):
    method test_create_queue (line 1188) | async def test_create_queue(self):
    method test_create_event (line 1195) | async def test_create_event(self):
    method test_service_task_started (line 1203) | async def test_service_task_started(self, import_module):
    method test_shutdown (line 1213) | async def test_shutdown(self, import_module):
    method test_transports_disallowed (line 1224) | async def test_transports_disallowed(self, import_module):

FILE: tests/async/test_socket.py
  class TestSocket (line 13) | class TestSocket:
    method _get_read_mock_coro (line 14) | def _get_read_mock_coro(self, payload):
    method _get_mock_server (line 20) | def _get_mock_server(self):
    method test_create (line 50) | async def test_create(self):
    method test_empty_poll (line 62) | async def test_empty_poll(self):
    method test_poll (line 68) | async def test_poll(self):
    method test_poll_none (line 77) | async def test_poll_none(self):
    method test_poll_none_after_packet (line 83) | async def test_poll_none_after_packet(self):
    method test_schedule_ping (line 92) | async def test_schedule_ping(self):
    method test_schedule_ping_closed_socket (line 106) | async def test_schedule_ping_closed_socket(self):
    method test_pong (line 121) | async def test_pong(self):
    method test_message_sync_handler (line 128) | async def test_message_sync_handler(self):
    method test_message_async_handler (line 136) | async def test_message_async_handler(self):
    method test_invalid_packet (line 145) | async def test_invalid_packet(self):
    method test_timeout (line 151) | async def test_timeout(self):
    method test_polling_read (line 162) | async def test_polling_read(self):
    method test_polling_read_error (line 173) | async def test_polling_read_error(self):
    method test_polling_write (line 180) | async def test_polling_write(self):
    method test_polling_write_too_large (line 197) | async def test_polling_write_too_large(self):
    method test_upgrade_handshake (line 214) | async def test_upgrade_handshake(self):
    method test_upgrade (line 227) | async def test_upgrade(self):
    method test_upgrade_twice (line 241) | async def test_upgrade_twice(self):
    method test_upgrade_packet (line 251) | async def test_upgrade_packet(self):
    method test_upgrade_no_probe (line 260) | async def test_upgrade_no_probe(self):
    method test_upgrade_no_upgrade_packet (line 270) | async def test_upgrade_no_upgrade_packet(self):
    method test_upgrade_not_supported (line 290) | async def test_upgrade_not_supported(self):
    method test_close_packet (line 299) | async def test_close_packet(self):
    method test_websocket_read_write (line 309) | async def test_websocket_read_write(self):
    method test_websocket_upgrade_read_write (line 341) | async def test_websocket_upgrade_read_write(self):
    method test_websocket_upgrade_with_payload (line 378) | async def test_websocket_upgrade_with_payload(self):
    method test_websocket_upgrade_with_backlog (line 395) | async def test_websocket_upgrade_with_backlog(self):
    method test_websocket_read_write_wait_fail (line 427) | async def test_websocket_read_write_wait_fail(self):
    method test_websocket_upgrade_with_large_packet (line 453) | async def test_websocket_upgrade_with_large_packet(self):
    method test_websocket_ignore_invalid_packet (line 470) | async def test_websocket_ignore_invalid_packet(self):
    method test_send_after_close (line 505) | async def test_send_after_close(self):
    method test_close_after_close (line 512) | async def test_close_after_close(self):
    method test_close_and_wait (line 525) | async def test_close_and_wait(self):
    method test_close_without_wait (line 534) | async def test_close_without_wait(self):

FILE: tests/async/test_tornado.py
  class TestTornado (line 11) | class TestTornado:
    method test_get_tornado_handler (line 12) | async def test_get_tornado_handler(self):
    method test_translate_request (line 17) | async def test_translate_request(self):
    method test_make_response (line 50) | async def test_make_response(self):

FILE: tests/common/test_client.py
  class TestClient (line 17) | class TestClient:
    method mock_queue (line 18) | def mock_queue(self, client):
    method test_is_asyncio_based (line 23) | def test_is_asyncio_based(self):
    method test_create (line 27) | def test_create(self):
    method test_custom_json (line 47) | def test_custom_json(self):
    method test_logger (line 54) | def test_logger(self):
    method test_custom_timeout (line 68) | def test_custom_timeout(self):
    method test_timestamp_requests (line 74) | def test_timestamp_requests(self):
    method test_on_event (line 82) | def test_on_event(self):
    method test_on_event_invalid (line 94) | def test_on_event_invalid(self):
    method test_already_connected (line 99) | def test_already_connected(self):
    method test_invalid_transports (line 105) | def test_invalid_transports(self):
    method test_some_invalid_transports (line 110) | def test_some_invalid_transports(self):
    method test_connect_polling (line 116) | def test_connect_polling(self):
    method test_connect_websocket (line 141) | def test_connect_websocket(self):
    method test_connect_query_string (line 156) | def test_connect_query_string(self):
    method test_connect_custom_headers (line 164) | def test_connect_custom_headers(self):
    method test_wait (line 172) | def test_wait(self):
    method test_wait_no_task (line 178) | def test_wait_no_task(self):
    method test_send (line 183) | def test_send(self):
    method test_disconnect_not_connected (line 204) | def test_disconnect_not_connected(self):
    method test_disconnect_polling (line 212) | def test_disconnect_polling(self):
    method test_disconnect_websocket (line 228) | def test_disconnect_websocket(self):
    method test_disconnect_polling_abort (line 244) | def test_disconnect_polling_abort(self):
    method test_disconnect_websocket_abort (line 258) | def test_disconnect_websocket_abort(self):
    method test_current_transport (line 272) | def test_current_transport(self):
    method test_background_tasks (line 277) | def test_background_tasks(self):
    method test_sleep (line 289) | def test_sleep(self):
    method test_create_queue (line 295) | def test_create_queue(self):
    method test_create_event (line 301) | def test_create_event(self):
    method test_polling_connection_failed (line 310) | def test_polling_connection_failed(self, _send_request, _time):
    method test_polling_connection_404 (line 322) | def test_polling_connection_404(self, _send_request):
    method test_polling_connection_404_no_json (line 336) | def test_polling_connection_404_no_json(self, _send_request):
    method test_polling_connection_invalid_packet (line 351) | def test_polling_connection_invalid_packet(self, _send_request):
    method test_polling_connection_no_open_packet (line 359) | def test_polling_connection_no_open_packet(self, _send_request):
    method test_polling_connection_successful (line 379) | def test_polling_connection_successful(self, _send_request):
    method test_polling_https_noverify_connection_successful (line 419) | def test_polling_https_noverify_connection_successful(self, _send_requ...
    method test_polling_connection_with_more_packets (line 459) | def test_polling_connection_with_more_packets(self, _send_request):
    method test_polling_connection_upgraded (line 491) | def test_polling_connection_upgraded(self, _send_request):
    method test_polling_connection_not_upgraded (line 527) | def test_polling_connection_not_upgraded(self, _send_request):
    method test_websocket_connection_failed (line 566) | def test_websocket_connection_failed(self, create_connection, _time):
    method test_websocket_connection_extra (line 585) | def test_websocket_connection_extra(self, create_connection, _time):
    method test_websocket_connection_failed_with_websocket_error (line 605) | def test_websocket_connection_failed_with_websocket_error(
    method test_websocket_upgrade_failed (line 626) | def test_websocket_upgrade_failed(self, create_connection, _time):
    method test_websocket_connection_no_open_packet (line 641) | def test_websocket_connection_no_open_packet(self, create_connection):
    method test_websocket_connection_successful (line 650) | def test_websocket_connection_successful(self, create_connection):
    method test_websocket_https_noverify_connection_successful (line 690) | def test_websocket_https_noverify_connection_successful(
    method test_websocket_connection_with_cookies (line 733) | def test_websocket_connection_with_cookies(self, create_connection):
    method test_websocket_connection_with_cookie_header (line 770) | def test_websocket_connection_with_cookie_header(self, create_connecti...
    method test_websocket_connection_with_cookies_and_headers (line 807) | def test_websocket_connection_with_cookies_and_headers(
    method test_websocket_connection_with_auth (line 850) | def test_websocket_connection_with_auth(self, create_connection):
    method test_websocket_connection_with_cert (line 882) | def test_websocket_connection_with_cert(self, create_connection):
    method test_websocket_connection_with_cert_and_key (line 915) | def test_websocket_connection_with_cert_and_key(self, create_connection):
    method test_websocket_connection_verify_with_cert_and_key (line 948) | def test_websocket_connection_verify_with_cert_and_key(
    method test_websocket_connection_with_proxies (line 988) | def test_websocket_connection_with_proxies(self, create_connection):
    method test_websocket_connection_without_verify (line 1055) | def test_websocket_connection_without_verify(self, create_connection):
    method test_websocket_connection_with_verify (line 1089) | def test_websocket_connection_with_verify(self, create_connection):
    method test_websocket_upgrade_no_pong (line 1123) | def test_websocket_upgrade_no_pong(self, create_connection):
    method test_websocket_upgrade_successful (line 1150) | def test_websocket_upgrade_successful(self, create_connection):
    method test_receive_unknown_packet (line 1183) | def test_receive_unknown_packet(self):
    method test_receive_noop_packet (line 1188) | def test_receive_noop_packet(self):
    method test_receive_ping_packet (line 1193) | def test_receive_ping_packet(self):
    method test_receive_message_packet (line 1199) | def test_receive_message_packet(self):
    method test_receive_close_packet (line 1207) | def test_receive_close_packet(self):
    method test_send_packet_disconnected (line 1214) | def test_send_packet_disconnected(self):
    method test_send_packet (line 1221) | def test_send_packet(self):
    method test_trigger_event (line 1230) | def test_trigger_event(self):
    method test_trigger_legacy_disconnect_event (line 1257) | def test_trigger_legacy_disconnect_event(self):
    method test_trigger_unknown_event (line 1267) | def test_trigger_unknown_event(self):
    method test_trigger_event_error (line 1273) | def test_trigger_event_error(self):
    method test_engineio_url (line 1289) | def test_engineio_url(self):
    method test_read_loop_polling_disconnected (line 1324) | def test_read_loop_polling_disconnected(self):
    method test_read_loop_polling_no_response (line 1334) | def test_read_loop_polling_no_response(self, _time):
    method test_read_loop_polling_bad_status (line 1355) | def test_read_loop_polling_bad_status(self, _time):
    method test_read_loop_polling_bad_packet (line 1374) | def test_read_loop_polling_bad_packet(self, _time):
    method test_read_loop_polling (line 1393) | def test_read_loop_polling(self):
    method test_read_loop_websocket_disconnected (line 1423) | def test_read_loop_websocket_disconnected(self):
    method test_read_loop_websocket_timeout (line 1430) | def test_read_loop_websocket_timeout(self):
    method test_read_loop_websocket_no_response (line 1442) | def test_read_loop_websocket_no_response(self):
    method test_read_loop_websocket_unexpected_error (line 1454) | def test_read_loop_websocket_unexpected_error(self):
    method test_read_loop_websocket (line 1466) | def test_read_loop_websocket(self):
    method test_write_loop_disconnected (line 1485) | def test_write_loop_disconnected(self):
    method test_write_loop_no_packets (line 1491) | def test_write_loop_no_packets(self):
    method test_write_loop_empty_queue (line 1502) | def test_write_loop_empty_queue(self):
    method test_write_loop_polling_one_packet (line 1512) | def test_write_loop_polling_one_packet(self):
    method test_write_loop_polling_three_packets (line 1540) | def test_write_loop_polling_three_packets(self):
    method test_write_loop_polling_two_packets_done (line 1574) | def test_write_loop_polling_two_packets_done(self):
    method test_write_loop_polling_bad_connection (line 1607) | def test_write_loop_polling_bad_connection(self):
    method test_write_loop_polling_bad_status (line 1635) | def test_write_loop_polling_bad_status(self):
    method test_write_loop_websocket_one_packet (line 1664) | def test_write_loop_websocket_one_packet(self):
    method test_write_loop_websocket_three_packets (line 1683) | def test_write_loop_websocket_three_packets(self):
    method test_write_loop_websocket_one_packet_binary (line 1706) | def test_write_loop_websocket_one_packet_binary(self):
    method test_write_loop_websocket_bad_connection (line 1725) | def test_write_loop_websocket_bad_connection(self):
    method test_signal_handler (line 1743) | def test_signal_handler(self, original_handler):

FILE: tests/common/test_middleware.py
  class TestWSGIApp (line 7) | class TestWSGIApp:
    method test_wsgi_routing (line 8) | def test_wsgi_routing(self):
    method test_eio_routing (line 17) | def test_eio_routing(self):
    method test_static_files (line 29) | def test_static_files(self):
    method test_404 (line 112) | def test_404(self):
    method test_custom_eio_path (line 124) | def test_custom_eio_path(self):
    method test_custom_eio_path_slashes (line 143) | def test_custom_eio_path_slashes(self):
    method test_custom_eio_path_leading_slash (line 157) | def test_custom_eio_path_leading_slash(self):
    method test_custom_eio_path_trailing_slash (line 169) | def test_custom_eio_path_trailing_slash(self):
    method test_gunicorn_socket (line 181) | def test_gunicorn_socket(self):
    method test_legacy_middleware_class (line 191) | def test_legacy_middleware_class(self):

FILE: tests/common/test_packet.py
  class TestPacket (line 6) | class TestPacket:
    method test_encode_default_packet (line 7) | def test_encode_default_packet(self):
    method test_decode_default_packet (line 14) | def test_decode_default_packet(self):
    method test_encode_text_packet (line 18) | def test_encode_text_packet(self):
    method test_decode_text_packet (line 26) | def test_decode_text_packet(self):
    method test_encode_empty_text_packet (line 30) | def test_encode_empty_text_packet(self):
    method test_decode_empty_text_packet (line 38) | def test_decode_empty_text_packet(self):
    method test_encode_binary_packet (line 42) | def test_encode_binary_packet(self):
    method test_encode_binary_bytearray_packet (line 49) | def test_encode_binary_bytearray_packet(self):
    method test_encode_binary_b64_packet (line 56) | def test_encode_binary_b64_packet(self):
    method test_encode_empty_binary_packet (line 63) | def test_encode_empty_binary_packet(self):
    method test_decode_binary_packet (line 70) | def test_decode_binary_packet(self):
    method test_decode_binary_bytearray_packet (line 74) | def test_decode_binary_bytearray_packet(self):
    method test_decode_binary_b64_packet (line 78) | def test_decode_binary_b64_packet(self):
    method test_decode_empty_binary_packet (line 82) | def test_decode_empty_binary_packet(self):
    method test_encode_json_packet (line 86) | def test_encode_json_packet(self):
    method test_decode_json_packet (line 96) | def test_decode_json_packet(self):
    method test_decode_json_packet_long_int (line 103) | def test_decode_json_packet_long_int(self):
    method test_encode_number_packet (line 111) | def test_encode_number_packet(self):
    method test_decode_number_packet (line 118) | def test_decode_number_packet(self):
    method test_binary_non_message_packet (line 128) | def test_binary_non_message_packet(self):
    method test_decode_invalid_empty_text_packet (line 132) | def test_decode_invalid_empty_text_packet(self):
    method test_encode_cache (line 136) | def test_encode_cache(self):

FILE: tests/common/test_payload.py
  class TestPayload (line 7) | class TestPayload:
    method test_encode_empty_payload (line 8) | def test_encode_empty_payload(self):
    method test_decode_empty_payload (line 13) | def test_decode_empty_payload(self):
    method test_encode_payload_text (line 17) | def test_encode_payload_text(self):
    method test_encode_payload_text_multiple (line 23) | def test_encode_payload_text_multiple(self):
    method test_encode_payload_binary (line 30) | def test_encode_payload_binary(self):
    method test_encode_payload_binary_multiple (line 36) | def test_encode_payload_binary_multiple(self):
    method test_encode_payload_text_binary_multiple (line 43) | def test_encode_payload_text_binary_multiple(self):
    method test_encode_jsonp_payload (line 50) | def test_encode_jsonp_payload(self):
    method test_decode_jsonp_payload (line 56) | def test_decode_jsonp_payload(self):
    method test_decode_invalid_payload (line 60) | def test_decode_invalid_payload(self):
    method test_decode_multi_payload_with_too_many_packets (line 64) | def test_decode_multi_payload_with_too_many_packets(self):

FILE: tests/common/test_server.py
  function _mock_import (line 21) | def _mock_import(module, *args, **kwargs):
  class TestServer (line 27) | class TestServer:
    method _get_mock_socket (line 36) | def _get_mock_socket(self):
    method setup_class (line 45) | def setup_class(cls):
    method teardown_class (line 49) | def teardown_class(cls):
    method setup_method (line 52) | def setup_method(self):
    method teardown_method (line 55) | def teardown_method(self):
    method test_is_asyncio_based (line 59) | def test_is_asyncio_based(self):
    method test_async_modes (line 63) | def test_async_modes(self):
    method test_create (line 72) | def test_create(self):
    method test_create_with_grace_period (line 90) | def test_create_with_grace_period(self):
    method test_create_ignores_kwargs (line 95) | def test_create_ignores_kwargs(self):
    method test_async_mode_threading (line 98) | def test_async_mode_threading(self):
    method test_async_mode_eventlet (line 112) | def test_async_mode_eventlet(self):
    method test_async_mode_gevent_uwsgi (line 137) | def test_async_mode_gevent_uwsgi(self, import_module):
    method test_async_mode_gevent_uwsgi_without_uwsgi (line 163) | def test_async_mode_gevent_uwsgi_without_uwsgi(self, import_module):
    method test_async_mode_gevent_uwsgi_without_websocket (line 180) | def test_async_mode_gevent_uwsgi_without_websocket(self, import_module):
    method test_async_mode_gevent (line 207) | def test_async_mode_gevent(self, import_module):
    method test_async_mode_aiohttp (line 233) | def test_async_mode_aiohttp(self, import_module):
    method test_async_mode_invalid (line 239) | def test_async_mode_invalid(self, import_module):
    method test_async_mode_auto_eventlet (line 247) | def test_async_mode_auto_eventlet(self, import_module):
    method test_async_mode_auto_gevent_uwsgi (line 254) | def test_async_mode_auto_gevent_uwsgi(self, import_module):
    method test_async_mode_auto_gevent (line 262) | def test_async_mode_auto_gevent(self, import_module):
    method test_async_mode_auto_threading (line 270) | def test_async_mode_auto_threading(self, import_module):
    method test_generate_id (line 274) | def test_generate_id(self):
    method test_on_event (line 278) | def test_on_event(self):
    method test_on_event_invalid (line 290) | def test_on_event_invalid(self):
    method test_trigger_event (line 295) | def test_trigger_event(self):
    method test_trigger_legacy_disconnect_event (line 322) | def test_trigger_legacy_disconnect_event(self):
    method test_trigger_event_error (line 332) | def test_trigger_event_error(self):
    method test_session (line 348) | def test_session(self):
    method test_close_one_socket (line 357) | def test_close_one_socket(self):
    method test_close_all_sockets (line 365) | def test_close_all_sockets(self):
    method test_upgrades (line 376) | def test_upgrades(self):
    method test_transport (line 389) | def test_transport(self):
    method test_bad_session (line 398) | def test_bad_session(self):
    method test_closed_socket (line 404) | def test_closed_socket(self):
    method test_jsonp_with_bad_index (line 411) | def test_jsonp_with_bad_index(self):
    method test_jsonp_index (line 418) | def test_jsonp_index(self):
    method test_connect (line 427) | def test_connect(self):
    method test_connect_no_upgrades (line 450) | def test_connect_no_upgrades(self):
    method test_connect_bad_eio_version (line 458) | def test_connect_bad_eio_version(self):
    method test_connect_custom_ping_times (line 466) | def test_connect_custom_ping_times(self):
    method test_connect_bad_poll (line 480) | def test_connect_bad_poll(self, poll):
    method test_connect_transport_websocket (line 491) | def test_connect_transport_websocket(self, Socket):
    method test_http_upgrade_case_insensitive (line 509) | def test_http_upgrade_case_insensitive(self, Socket):
    method test_connect_transport_websocket_closed (line 527) | def test_connect_transport_websocket_closed(self, Socket):
    method test_connect_transport_invalid (line 544) | def test_connect_transport_invalid(self):
    method test_connect_transport_websocket_without_upgrade (line 552) | def test_connect_transport_websocket_without_upgrade(self):
    method test_connect_cors_headers (line 562) | def test_connect_cors_headers(self):
    method test_connect_cors_allowed_origin (line 571) | def test_connect_cors_allowed_origin(self):
    method test_connect_cors_allowed_origin_with_callable (line 584) | def test_connect_cors_allowed_origin_with_callable(self):
    method test_connect_cors_not_allowed_origin (line 604) | def test_connect_cors_not_allowed_origin(self):
    method test_connect_str_cors_headers_all_origins (line 618) | def test_connect_str_cors_headers_all_origins(self):
    method test_connect_list_cors_headers_all_origins (line 632) | def test_connect_list_cors_headers_all_origins(self):
    method test_connect_cors_headers_one_origin (line 646) | def test_connect_cors_headers_one_origin(self):
    method test_connect_cors_headers_one_origin_not_allowed (line 660) | def test_connect_cors_headers_one_origin_not_allowed(self):
    method test_connect_cors_headers_default_origin (line 674) | def test_connect_cors_headers_default_origin(self):
    method test_connect_cors_headers_default_origin_proxy_server (line 689) | def test_connect_cors_headers_default_origin_proxy_server(self):
    method test_connect_cors_headers_default_origin_proxy_server2 (line 705) | def test_connect_cors_headers_default_origin_proxy_server2(self):
    method test_connect_cors_no_credentials (line 722) | def test_connect_cors_no_credentials(self):
    method test_cors_options (line 731) | def test_cors_options(self):
    method test_cors_request_headers (line 743) | def test_cors_request_headers(self):
    method test_connect_cors_disabled (line 756) | def test_connect_cors_disabled(self):
    method test_connect_cors_default_no_origin (line 770) | def test_connect_cors_default_no_origin(self):
    method test_connect_str_cors_all_no_origin (line 779) | def test_connect_str_cors_all_no_origin(self):
    method test_connect_list_cors_all_no_origin (line 788) | def test_connect_list_cors_all_no_origin(self):
    method test_connect_cors_disabled_no_origin (line 797) | def test_connect_cors_disabled_no_origin(self):
    method test_connect_event (line 806) | def test_connect_event(self):
    method test_connect_event_rejects (line 817) | def test_connect_event_rejects(self):
    method test_connect_event_rejects_with_message (line 829) | def test_connect_event_rejects_with_message(self):
    method test_method_not_found (line 841) | def test_method_not_found(self):
    method test_get_request_with_bad_sid (line 848) | def test_get_request_with_bad_sid(self):
    method test_post_request_with_bad_sid (line 855) | def test_post_request_with_bad_sid(self):
    method test_send (line 862) | def test_send(self):
    method test_send_unknown_socket (line 871) | def test_send_unknown_socket(self):
    method test_get_request (line 876) | def test_get_request(self):
    method test_get_request_custom_response (line 892) | def test_get_request_custom_response(self):
    method test_get_request_closes_socket (line 901) | def test_get_request_closes_socket(self):
    method test_get_request_error (line 916) | def test_get_request_error(self):
    method test_get_request_bad_websocket_transport (line 929) | def test_get_request_bad_websocket_transport(self):
    method test_get_request_bad_polling_transport (line 940) | def test_get_request_bad_polling_transport(self):
    method test_post_request (line 951) | def test_post_request(self):
    method test_post_request_error (line 961) | def test_post_request_error(self):
    method _gzip_decompress (line 975) | def _gzip_decompress(b):
    method test_gzip_compression (line 980) | def test_gzip_compression(self):
    method test_deflate_compression (line 997) | def test_deflate_compression(self):
    method test_gzip_compression_threshold (line 1016) | def test_gzip_compression_threshold(self):
    method test_compression_disabled (line 1035) | def test_compression_disabled(self):
    method test_compression_unknown (line 1054) | def test_compression_unknown(self):
    method test_compression_no_encoding (line 1073) | def test_compression_no_encoding(self):
    method test_cookie (line 1092) | def test_cookie(self):
    method test_cookie_dict (line 1101) | def test_cookie_dict(self):
    method test_no_cookie (line 1119) | def test_no_cookie(self):
    method test_logger (line 1128) | def test_logger(self):
    method test_custom_json (line 1142) | def test_custom_json(self):
    method test_background_tasks (line 1164) | def test_background_tasks(self):
    method test_sleep (line 1176) | def test_sleep(self):
    method test_create_queue (line 1182) | def test_create_queue(self):
    method test_create_event (line 1189) | def test_create_event(self):
    method test_log_error_once (line 1196) | def test_log_error_once(self):
    method test_service_task_started (line 1205) | def test_service_task_started(self):
    method test_shutdown (line 1217) | def test_shutdown(self):
    method test_transports_invalid (line 1226) | def test_transports_invalid(self):
    method test_transports_disallowed (line 1232) | def test_transports_disallowed(self):

FILE: tests/common/test_socket.py
  class TestSocket (line 13) | class TestSocket:
    method setup_method (line 14) | def setup_method(self):
    method _get_mock_server (line 17) | def _get_mock_server(self):
    method _join_bg_tasks (line 51) | def _join_bg_tasks(self):
    method test_create (line 55) | def test_create(self):
    method test_empty_poll (line 67) | def test_empty_poll(self):
    method test_poll (line 73) | def test_poll(self):
    method test_poll_none (line 82) | def test_poll_none(self):
    method test_poll_none_after_packet (line 88) | def test_poll_none_after_packet(self):
    method test_schedule_ping (line 97) | def test_schedule_ping(self):
    method test_schedule_ping_closed_socket (line 107) | def test_schedule_ping_closed_socket(self):
    method test_pong (line 118) | def test_pong(self):
    method test_message_async_handler (line 125) | def test_message_async_handler(self):
    method test_message_sync_handler (line 133) | def test_message_sync_handler(self):
    method test_invalid_packet (line 142) | def test_invalid_packet(self):
    method test_timeout (line 148) | def test_timeout(self):
    method test_polling_read (line 159) | def test_polling_read(self):
    method test_polling_read_error (line 171) | def test_polling_read_error(self):
    method test_polling_write (line 179) | def test_polling_write(self):
    method test_polling_write_too_large (line 196) | def test_polling_write_too_large(self):
    method test_upgrade_handshake (line 213) | def test_upgrade_handshake(self):
    method test_upgrade (line 227) | def test_upgrade(self):
    method test_upgrade_twice (line 242) | def test_upgrade_twice(self):
    method test_upgrade_packet (line 253) | def test_upgrade_packet(self):
    method test_upgrade_no_probe (line 262) | def test_upgrade_no_probe(self):
    method test_upgrade_no_upgrade_packet (line 271) | def test_upgrade_no_upgrade_packet(self):
    method test_close_packet (line 289) | def test_close_packet(self):
    method test_invalid_packet_type (line 299) | def test_invalid_packet_type(self):
    method test_upgrade_not_supported (line 306) | def test_upgrade_not_supported(self):
    method test_websocket_read_write (line 316) | def test_websocket_read_write(self):
    method test_websocket_upgrade_read_write (line 349) | def test_websocket_upgrade_read_write(self):
    method test_websocket_upgrade_with_payload (line 384) | def test_websocket_upgrade_with_payload(self):
    method test_websocket_upgrade_with_backlog (line 399) | def test_websocket_upgrade_with_backlog(self):
    method test_websocket_read_write_wait_fail (line 430) | def test_websocket_read_write_wait_fail(self):
    method test_websocket_upgrade_with_large_packet (line 454) | def test_websocket_upgrade_with_large_packet(self):
    method test_websocket_ignore_invalid_packet (line 470) | def test_websocket_ignore_invalid_packet(self):
    method test_send_after_close (line 503) | def test_send_after_close(self):
    method test_close_after_close (line 510) | def test_close_after_close(self):
    method test_close_and_wait (line 523) | def test_close_and_wait(self):
    method test_close_without_wait (line 530) | def test_close_without_wait(self):

FILE: tests/performance/binary_b64_packet.py
  function test (line 5) | def test():

FILE: tests/performance/binary_packet.py
  function test (line 5) | def test():

FILE: tests/performance/json_packet.py
  function test (line 5) | def test():

FILE: tests/performance/payload.py
  function test (line 5) | def test():

FILE: tests/performance/server_receive.py
  function test (line 7) | def test(eio_version, payload):

FILE: tests/performance/text_packet.py
  function test (line 5) | def test():
Condensed preview — 144 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (1,341K chars).
[
  {
    "path": ".gitattributes",
    "chars": 309,
    "preview": "example/wsgi/static/engine.io.js linguist-vendored\nexample/aiohttp/static/engine.io.js linguist-vendored\n\ntests/common/i"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "chars": 1245,
    "preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**IMPORTANT**: I"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/config.yml",
    "chars": 174,
    "preview": "blank_issues_enabled: false\ncontact_links:\n  - name: GitHub Discussions\n    url: https://github.com/miguelgrinberg/pytho"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "chars": 961,
    "preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your fea"
  },
  {
    "path": ".github/workflows/tests.yml",
    "chars": 1298,
    "preview": "name: build\non:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\njobs:\n  lint:\n    name: li"
  },
  {
    "path": ".gitignore",
    "chars": 411,
    "preview": "*.py[cod]\n\n# C extensions\n*.so\n\n# Packages\n*.egg\n*.egg-info\ndist\nbuild\neggs\nparts\nvar\nsdist\ndevelop-eggs\n.installed.cfg\n"
  },
  {
    "path": ".readthedocs.yaml",
    "chars": 198,
    "preview": "version: 2\n\nbuild:\n  os: ubuntu-22.04\n  tools:\n    python: \"3.11\"\n\nsphinx:\n  configuration: docs/conf.py\n\npython:\n  inst"
  },
  {
    "path": "CHANGES.md",
    "chars": 86144,
    "preview": "# python-engineio change log\n\n**Release 4.13.1** - 2026-02-06\n\n- Document that a process can have only one custom JSON m"
  },
  {
    "path": "LICENSE",
    "chars": 1082,
    "preview": "The MIT License (MIT)\n\nCopyright (c) 2015 Miguel Grinberg\n\nPermission is hereby granted, free of charge, to any person o"
  },
  {
    "path": "MANIFEST.in",
    "chars": 72,
    "preview": "include README.md LICENSE tox.ini tests/**/* docs/**/*\nexclude **/*.pyc\n"
  },
  {
    "path": "README.md",
    "chars": 1277,
    "preview": "python-engineio\n===============\n\n[![Build status](https://github.com/miguelgrinberg/python-engineio/workflows/build/badg"
  },
  {
    "path": "SECURITY.md",
    "chars": 556,
    "preview": "# Security Policy\n\n## Reporting a Vulnerability\n\nIf you think you've found a vulnerability on this project, please send "
  },
  {
    "path": "docs/Makefile",
    "chars": 580,
    "preview": "# Minimal makefile for Sphinx documentation\n#\n\n# You can set these variables from the command line.\nSPHINXOPTS    =\nSPHI"
  },
  {
    "path": "docs/_static/README.md",
    "chars": 51,
    "preview": "Place static files used by the documentation here.\n"
  },
  {
    "path": "docs/api.rst",
    "chars": 176,
    "preview": "API Reference\n=============\n\n.. toctree::\n   :maxdepth: 2\n\n   api_client\n   api_async_client\n   api_server\n   api_async_"
  },
  {
    "path": "docs/api_asgiapp.rst",
    "chars": 46,
    "preview": ".. autoclass:: engineio.ASGIApp\n   :members:\n\n"
  },
  {
    "path": "docs/api_async_client.rst",
    "chars": 73,
    "preview": ".. autoclass:: engineio.AsyncClient\n   :members:\n   :inherited-members:\n\n"
  },
  {
    "path": "docs/api_async_server.rst",
    "chars": 73,
    "preview": ".. autoclass:: engineio.AsyncServer\n   :members:\n   :inherited-members:\n\n"
  },
  {
    "path": "docs/api_client.rst",
    "chars": 68,
    "preview": ".. autoclass:: engineio.Client\n   :members:\n   :inherited-members:\n\n"
  },
  {
    "path": "docs/api_middleware.rst",
    "chars": 49,
    "preview": ".. autoclass:: engineio.Middleware\n   :members:\n\n"
  },
  {
    "path": "docs/api_server.rst",
    "chars": 68,
    "preview": ".. autoclass:: engineio.Server\n   :members:\n   :inherited-members:\n\n"
  },
  {
    "path": "docs/api_wsgiapp.rst",
    "chars": 46,
    "preview": ".. autoclass:: engineio.WSGIApp\n   :members:\n\n"
  },
  {
    "path": "docs/client.rst",
    "chars": 6160,
    "preview": "The Engine.IO Client\n====================\n\nThis package contains two Engine.IO clients:\n\n- The :func:`engineio.Client` c"
  },
  {
    "path": "docs/conf.py",
    "chars": 5267,
    "preview": "#\n# Configuration file for the Sphinx documentation builder.\n#\n# This file does only contain a selection of the most com"
  },
  {
    "path": "docs/index.rst",
    "chars": 540,
    "preview": ".. python-engineio documentation master file, created by\n   sphinx-quickstart on Sat Nov 24 09:42:25 2018.\n   You can ad"
  },
  {
    "path": "docs/intro.rst",
    "chars": 5086,
    "preview": ".. engineio documentation master file, created by\n   sphinx-quickstart on Sat Jun 13 23:41:23 2015.\n   You can adapt thi"
  },
  {
    "path": "docs/make.bat",
    "chars": 787,
    "preview": "@ECHO OFF\r\n\r\npushd %~dp0\r\n\r\nREM Command file for Sphinx documentation\r\n\r\nif \"%SPHINXBUILD%\" == \"\" (\r\n\tset SPHINXBUILD=sp"
  },
  {
    "path": "docs/server.rst",
    "chars": 24706,
    "preview": "The Engine.IO Server\n====================\n\nThis package contains two Engine.IO servers:\n\n- The :func:`engineio.Server` c"
  },
  {
    "path": "examples/README.rst",
    "chars": 210,
    "preview": "Engine.IO Examples\n==================\n\nThis directory contains several example Engine.IO applications. Look in the\n`serv"
  },
  {
    "path": "examples/client/README.rst",
    "chars": 405,
    "preview": "Engine.IO Client Examples\n=========================\n\nThis directory contains several example Engine.IO client applicatio"
  },
  {
    "path": "examples/client/asyncio/README.rst",
    "chars": 1020,
    "preview": "Engine.IO Asyncio Examples\n==========================\n\nThis directory contains example Engine.IO clients that work with "
  },
  {
    "path": "examples/client/asyncio/latency_client.py",
    "chars": 637,
    "preview": "import asyncio\nimport time\nimport engineio\n\neio = engineio.AsyncClient()\nstart_timer = None\n\n\nasync def send_ping():\n   "
  },
  {
    "path": "examples/client/asyncio/simple_client.py",
    "chars": 1180,
    "preview": "import asyncio\nimport signal\nimport engineio\n\neio = engineio.AsyncClient()\nexit_event = asyncio.Event()\noriginal_signal_"
  },
  {
    "path": "examples/client/javascript/README.md",
    "chars": 332,
    "preview": "# eio-latency\n\nThis is a JavaScript example intended to be used when testing interoperability with Python.\n\n## Running\n\n"
  },
  {
    "path": "examples/client/javascript/latency_client.js",
    "chars": 419,
    "preview": "const io = require('engine.io-client')\nconst port = process.env.PORT || 5000;\n\nconst socket = io('http://localhost:' + p"
  },
  {
    "path": "examples/client/javascript/package.json",
    "chars": 214,
    "preview": "{\n  \"name\": \"eio-latency\",\n  \"version\": \"0.1.0\",\n  \"dependencies\": {\n    \"enchilada\": \"0.13.0\",\n    \"engine.io\": \"^6.6.2"
  },
  {
    "path": "examples/client/threads/README.rst",
    "chars": 1026,
    "preview": "Engine.IO Threading Examples\n============================\n\nThis directory contains example Engine.IO clients that work w"
  },
  {
    "path": "examples/client/threads/latency_client.py",
    "chars": 503,
    "preview": "import time\nimport engineio\n\neio = engineio.Client()\nstart_timer = None\n\n\ndef send_ping():\n    global start_timer\n    st"
  },
  {
    "path": "examples/client/threads/simple_client.py",
    "chars": 984,
    "preview": "import signal\nimport threading\nimport engineio\n\neio = engineio.Client()\nexit_event = threading.Event()\noriginal_signal_h"
  },
  {
    "path": "examples/server/README.rst",
    "chars": 636,
    "preview": "Engine.IO Server Examples\n=========================\n\nThis directory contains several example Engine.IO server applicatio"
  },
  {
    "path": "examples/server/aiohttp/README.rst",
    "chars": 1063,
    "preview": "Engine.IO Examples\n==================\n\nThis directory contains example Engine.IO applications that are compatible\nwith a"
  },
  {
    "path": "examples/server/aiohttp/latency.html",
    "chars": 1889,
    "preview": "<!doctype html>\n<html>\n  <head>\n    <title>EIO Latency</title>\n    <link rel=\"stylesheet\" href=\"/static/style.css\" />\n  "
  },
  {
    "path": "examples/server/aiohttp/latency.py",
    "chars": 473,
    "preview": "from aiohttp import web\n\nimport engineio\n\neio = engineio.AsyncServer(async_mode='aiohttp')\napp = web.Application()\neio.a"
  },
  {
    "path": "examples/server/aiohttp/requirements.txt",
    "chars": 109,
    "preview": "aiohttp==3.13.4\nasync-timeout==1.1.0\nchardet==2.3.0\nmultidict==2.1.4\npython-engineio\nsix==1.10.0\nyarl==0.8.1\n"
  },
  {
    "path": "examples/server/aiohttp/simple.html",
    "chars": 864,
    "preview": "<html>\n<head>\n<script src=\"/static/engine.io.js\"></script>\n<script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jq"
  },
  {
    "path": "examples/server/aiohttp/simple.py",
    "chars": 698,
    "preview": "from aiohttp import web\n\nimport engineio\n\neio = engineio.AsyncServer(async_mode='aiohttp')\napp = web.Application()\neio.a"
  },
  {
    "path": "examples/server/aiohttp/static/engine.io.js",
    "chars": 120917,
    "preview": "/*!\n * Engine.IO v4.0.4\n * (c) 2014-2020 Guillermo Rauch\n * Released under the MIT License.\n */\n(function webpackUnivers"
  },
  {
    "path": "examples/server/aiohttp/static/style.css",
    "chars": 182,
    "preview": "body { margin: 0; padding: 0; font-family: Helvetica Neue; }\nh1 { margin: 100px 100px 10px; }\nh2 { color: #999; margin: "
  },
  {
    "path": "examples/server/asgi/README.rst",
    "chars": 1017,
    "preview": "Engine.IO Examples\n==================\n\nThis directory contains example Engine.IO applications that are compatible\nwith a"
  },
  {
    "path": "examples/server/asgi/latency.html",
    "chars": 1889,
    "preview": "<!doctype html>\n<html>\n  <head>\n    <title>EIO Latency</title>\n    <link rel=\"stylesheet\" href=\"/static/style.css\" />\n  "
  },
  {
    "path": "examples/server/asgi/latency.py",
    "chars": 337,
    "preview": "import uvicorn\n\nimport engineio\n\neio = engineio.AsyncServer(async_mode='asgi')\napp = engineio.ASGIApp(eio, static_files="
  },
  {
    "path": "examples/server/asgi/requirements.txt",
    "chars": 116,
    "preview": "Click==7.0\nh11==0.16.0\nhttptools==0.0.13\npython_engineio\nsix==1.11.0\nuvicorn==0.11.7\nuvloop==0.12.2\nwebsockets==7.0\n"
  },
  {
    "path": "examples/server/asgi/simple.html",
    "chars": 864,
    "preview": "<html>\n<head>\n<script src=\"/static/engine.io.js\"></script>\n<script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jq"
  },
  {
    "path": "examples/server/asgi/simple.py",
    "chars": 562,
    "preview": "import uvicorn\n\nimport engineio\n\neio = engineio.AsyncServer(async_mode='asgi')\napp = engineio.ASGIApp(eio, static_files="
  },
  {
    "path": "examples/server/asgi/static/engine.io.js",
    "chars": 120917,
    "preview": "/*!\n * Engine.IO v4.0.4\n * (c) 2014-2020 Guillermo Rauch\n * Released under the MIT License.\n */\n(function webpackUnivers"
  },
  {
    "path": "examples/server/asgi/static/style.css",
    "chars": 182,
    "preview": "body { margin: 0; padding: 0; font-family: Helvetica Neue; }\nh1 { margin: 100px 100px 10px; }\nh2 { color: #999; margin: "
  },
  {
    "path": "examples/server/javascript/README.md",
    "chars": 320,
    "preview": "# eio-latency\n\nThis is a JavaScript example intended to be used when testing interoperability with Python.\n\n## Running\n\n"
  },
  {
    "path": "examples/server/javascript/index.html",
    "chars": 372,
    "preview": "<!doctype html>\n<html>\n  <head>\n    <title>EIO Latency</title>\n    <link rel=\"stylesheet\" href=\"/style.css\" />\n  </head>"
  },
  {
    "path": "examples/server/javascript/index.js",
    "chars": 793,
    "preview": "/**\n * Module dependencies.\n */\n\nconst express = require('express');\nconst app = express();\nconst server = require('http"
  },
  {
    "path": "examples/server/javascript/package.json",
    "chars": 214,
    "preview": "{\n  \"name\": \"eio-latency\",\n  \"version\": \"0.1.0\",\n  \"dependencies\": {\n    \"enchilada\": \"0.13.0\",\n    \"engine.io\": \"^6.6.2"
  },
  {
    "path": "examples/server/javascript/public/index.js",
    "chars": 1168,
    "preview": "/**\n * Module dependencies.\n */\n\nconst SmoothieChart = require('smoothie').SmoothieChart;\nconst TimeSeries = require('sm"
  },
  {
    "path": "examples/server/javascript/public/style.css",
    "chars": 182,
    "preview": "body { margin: 0; padding: 0; font-family: Helvetica Neue; }\nh1 { margin: 100px 100px 10px; }\nh2 { color: #999; margin: "
  },
  {
    "path": "examples/server/sanic/README.rst",
    "chars": 1062,
    "preview": "Engine.IO Examples\n==================\n\nThis directory contains example Engine.IO applications that are compatible\nwith a"
  },
  {
    "path": "examples/server/sanic/latency.html",
    "chars": 1889,
    "preview": "<!doctype html>\n<html>\n  <head>\n    <title>EIO Latency</title>\n    <link rel=\"stylesheet\" href=\"/static/style.css\" />\n  "
  },
  {
    "path": "examples/server/sanic/latency.py",
    "chars": 437,
    "preview": "from sanic import Sanic\nfrom sanic.response import html\n\nimport engineio\n\neio = engineio.AsyncServer(async_mode='sanic')"
  },
  {
    "path": "examples/server/sanic/requirements.txt",
    "chars": 131,
    "preview": "aiofiles==0.8.0\nhttptools==0.3.0\nmultidict==5.2.0\nsanic==21.12.2\nsanic-routing==0.7.2\nujson==5.4.0\nuvloop==0.16.0\nwebsoc"
  },
  {
    "path": "examples/server/sanic/simple.html",
    "chars": 864,
    "preview": "<html>\n<head>\n<script src=\"/static/engine.io.js\"></script>\n<script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jq"
  },
  {
    "path": "examples/server/sanic/simple.py",
    "chars": 661,
    "preview": "from sanic import Sanic\nfrom sanic.response import html\n\nimport engineio\n\neio = engineio.AsyncServer(async_mode='sanic')"
  },
  {
    "path": "examples/server/sanic/static/engine.io.js",
    "chars": 120917,
    "preview": "/*!\n * Engine.IO v4.0.4\n * (c) 2014-2020 Guillermo Rauch\n * Released under the MIT License.\n */\n(function webpackUnivers"
  },
  {
    "path": "examples/server/sanic/static/style.css",
    "chars": 182,
    "preview": "body { margin: 0; padding: 0; font-family: Helvetica Neue; }\nh1 { margin: 100px 100px 10px; }\nh2 { color: #999; margin: "
  },
  {
    "path": "examples/server/tornado/README.rst",
    "chars": 1065,
    "preview": "Engine.IO Examples\n==================\n\nThis directory contains example Engine.IO applications that are compatible\nwith t"
  },
  {
    "path": "examples/server/tornado/latency.py",
    "chars": 985,
    "preview": "import os\n\nimport tornado.ioloop\nfrom tornado.options import define, options, parse_command_line\nimport tornado.web\n\nimp"
  },
  {
    "path": "examples/server/tornado/requirements.txt",
    "chars": 43,
    "preview": "tornado==6.5.5\npython-engineio\nsix==1.10.0\n"
  },
  {
    "path": "examples/server/tornado/simple.py",
    "chars": 1210,
    "preview": "import os\n\nimport tornado.ioloop\nfrom tornado.options import define, options, parse_command_line\nimport tornado.web\n\nimp"
  },
  {
    "path": "examples/server/tornado/static/engine.io.js",
    "chars": 120917,
    "preview": "/*!\n * Engine.IO v4.0.4\n * (c) 2014-2020 Guillermo Rauch\n * Released under the MIT License.\n */\n(function webpackUnivers"
  },
  {
    "path": "examples/server/tornado/static/style.css",
    "chars": 182,
    "preview": "body { margin: 0; padding: 0; font-family: Helvetica Neue; }\nh1 { margin: 100px 100px 10px; }\nh2 { color: #999; margin: "
  },
  {
    "path": "examples/server/tornado/templates/latency.html",
    "chars": 1889,
    "preview": "<!doctype html>\n<html>\n  <head>\n    <title>EIO Latency</title>\n    <link rel=\"stylesheet\" href=\"/static/style.css\" />\n  "
  },
  {
    "path": "examples/server/tornado/templates/simple.html",
    "chars": 864,
    "preview": "<html>\n<head>\n<script src=\"/static/engine.io.js\"></script>\n<script src=\"//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jq"
  },
  {
    "path": "examples/server/wsgi/README.rst",
    "chars": 1779,
    "preview": "Engine.IO WSGI Examples\n=======================\n\nThis directory contains example Engine.IO applications that work togeth"
  },
  {
    "path": "examples/server/wsgi/latency.py",
    "chars": 1344,
    "preview": "from flask import Flask, render_template\n\nimport engineio\n\n# set async_mode to 'threading', 'eventlet' or 'gevent' to fo"
  },
  {
    "path": "examples/server/wsgi/requirements.txt",
    "chars": 234,
    "preview": "appdirs==1.4.0\nclick==6.7\nenum-compat==0.0.2\nenum34==1.1.6\neventlet==0.40.3\nFlask==1.0.2\ngreenlet==0.4.12\nitsdangerous=="
  },
  {
    "path": "examples/server/wsgi/simple.py",
    "chars": 1573,
    "preview": "from flask import Flask, render_template\n\nimport engineio\n\n# set async_mode to 'threading', 'eventlet' or 'gevent' to fo"
  },
  {
    "path": "examples/server/wsgi/static/engine.io.js",
    "chars": 120917,
    "preview": "/*!\n * Engine.IO v4.0.4\n * (c) 2014-2020 Guillermo Rauch\n * Released under the MIT License.\n */\n(function webpackUnivers"
  },
  {
    "path": "examples/server/wsgi/static/style.css",
    "chars": 182,
    "preview": "body { margin: 0; padding: 0; font-family: Helvetica Neue; }\nh1 { margin: 100px 100px 10px; }\nh2 { color: #999; margin: "
  },
  {
    "path": "examples/server/wsgi/templates/latency.html",
    "chars": 1945,
    "preview": "<!doctype html>\n<html>\n  <head>\n    <title>EIO Latency</title>\n    <link rel=\"stylesheet\" href=\"{{ url_for('static', fil"
  },
  {
    "path": "examples/server/wsgi/templates/simple.html",
    "chars": 892,
    "preview": "<html>\n<head>\n<script src=\"{{ url_for('static', filename='engine.io.js') }}\"></script>\n<script src=\"//cdnjs.cloudflare.c"
  },
  {
    "path": "pyproject.toml",
    "chars": 1239,
    "preview": "[project]\nname = \"python-engineio\"\nversion = \"4.13.2.dev0\"\nlicense = {text = \"MIT\"}\nauthors = [{name = \"Miguel Grinberg\""
  },
  {
    "path": "src/engineio/__init__.py",
    "chars": 481,
    "preview": "from .client import Client\nfrom .middleware import WSGIApp, Middleware\nfrom .server import Server\nfrom .async_server imp"
  },
  {
    "path": "src/engineio/async_client.py",
    "chars": 29976,
    "preview": "import asyncio\nfrom http.cookies import SimpleCookie\nimport inspect\nimport signal\nimport ssl\nimport threading\n\ntry:\n    "
  },
  {
    "path": "src/engineio/async_drivers/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "src/engineio/async_drivers/_websocket_wsgi.py",
    "chars": 949,
    "preview": "import simple_websocket\n\n\nclass SimpleWebSocketWSGI:  # pragma: no cover\n    \"\"\"\n    This wrapper class provides a threa"
  },
  {
    "path": "src/engineio/async_drivers/aiohttp.py",
    "chars": 3624,
    "preview": "import inspect\nimport sys\n\nfrom aiohttp.web import Response, WebSocketResponse\n\n\ndef create_route(app, engineio_server, "
  },
  {
    "path": "src/engineio/async_drivers/asgi.py",
    "chars": 11383,
    "preview": "import inspect\nimport os\nimport sys\n\nfrom engineio.static_files import get_static_file\n\n\nclass ASGIApp:\n    \"\"\"ASGI appl"
  },
  {
    "path": "src/engineio/async_drivers/eventlet.py",
    "chars": 1735,
    "preview": "from eventlet.green.threading import Event\nfrom eventlet import queue, sleep, spawn\nfrom eventlet.websocket import WebSo"
  },
  {
    "path": "src/engineio/async_drivers/gevent.py",
    "chars": 2962,
    "preview": "import gevent\nfrom gevent import queue\nfrom gevent.event import Event\ntry:\n    # use gevent-websocket if installed\n    i"
  },
  {
    "path": "src/engineio/async_drivers/gevent_uwsgi.py",
    "chars": 5954,
    "preview": "import gevent\nfrom gevent import queue\nfrom gevent.event import Event\nfrom gevent import selectors\nimport uwsgi\n_websock"
  },
  {
    "path": "src/engineio/async_drivers/sanic.py",
    "chars": 4495,
    "preview": "import sys\nfrom urllib.parse import urlsplit\n\ntry:  # pragma: no cover\n    from sanic.response import HTTPResponse\n    t"
  },
  {
    "path": "src/engineio/async_drivers/threading.py",
    "chars": 463,
    "preview": "import queue\nimport threading\nimport time\nfrom engineio.async_drivers._websocket_wsgi import SimpleWebSocketWSGI\n\n\nclass"
  },
  {
    "path": "src/engineio/async_drivers/tornado.py",
    "chars": 5908,
    "preview": "import asyncio\nimport inspect\nimport sys\nfrom urllib.parse import urlsplit\nfrom .. import exceptions\n\nimport tornado.web"
  },
  {
    "path": "src/engineio/async_server.py",
    "chars": 27557,
    "preview": "import asyncio\nimport inspect\nimport urllib\n\nfrom . import base_server\nfrom . import exceptions\nfrom . import packet\nfro"
  },
  {
    "path": "src/engineio/async_socket.py",
    "chars": 10715,
    "preview": "import asyncio\nimport sys\nimport time\n\nfrom . import base_socket\nfrom . import exceptions\nfrom . import packet\nfrom . im"
  },
  {
    "path": "src/engineio/base_client.py",
    "chars": 5827,
    "preview": "import logging\nimport signal\nimport threading\nimport time\nimport urllib\nfrom . import packet\n\ndefault_logger = logging.g"
  },
  {
    "path": "src/engineio/base_server.py",
    "chars": 14763,
    "preview": "import base64\nimport gzip\nimport importlib\nimport io\nimport logging\nimport secrets\nimport zlib\n\nfrom . import packet\nfro"
  },
  {
    "path": "src/engineio/base_socket.py",
    "chars": 399,
    "preview": "class BaseSocket:\n    upgrade_protocols = ['websocket']\n\n    def __init__(self, server, sid):\n        self.server = serv"
  },
  {
    "path": "src/engineio/client.py",
    "chars": 27784,
    "preview": "from base64 import b64encode\nfrom http.cookies import SimpleCookie\nimport logging\nimport queue\nimport ssl\nimport threadi"
  },
  {
    "path": "src/engineio/exceptions.py",
    "chars": 292,
    "preview": "class EngineIOError(Exception):\n    pass\n\n\nclass ContentTooLongError(EngineIOError):\n    pass\n\n\nclass UnknownPacketError"
  },
  {
    "path": "src/engineio/json.py",
    "chars": 405,
    "preview": "\"\"\"JSON-compatible module with sane defaults.\"\"\"\n\nfrom json import *  # noqa: F401, F403\nfrom json import loads as origi"
  },
  {
    "path": "src/engineio/middleware.py",
    "chars": 3750,
    "preview": "import os\nfrom engineio.static_files import get_static_file\n\n\nclass WSGIApp:\n    \"\"\"WSGI application middleware for Engi"
  },
  {
    "path": "src/engineio/packet.py",
    "chars": 3198,
    "preview": "import base64\nfrom engineio import json as _json\n\n(OPEN, CLOSE, PING, PONG, MESSAGE, UPGRADE, NOOP) = (0, 1, 2, 3, 4, 5,"
  },
  {
    "path": "src/engineio/payload.py",
    "chars": 1539,
    "preview": "import urllib\n\nfrom . import packet\n\n\nclass Payload:\n    \"\"\"Engine.IO payload.\"\"\"\n    max_decode_packets = 16\n\n    def _"
  },
  {
    "path": "src/engineio/server.py",
    "chars": 23087,
    "preview": "import logging\nimport urllib\n\nfrom . import base_server\nfrom . import exceptions\nfrom . import packet\nfrom . import sock"
  },
  {
    "path": "src/engineio/socket.py",
    "chars": 10342,
    "preview": "import sys\nimport time\n\nfrom . import base_socket\nfrom . import exceptions\nfrom . import packet\nfrom . import payload\n\n\n"
  },
  {
    "path": "src/engineio/static_files.py",
    "chars": 2064,
    "preview": "content_types = {\n    'css': 'text/css',\n    'gif': 'image/gif',\n    'html': 'text/html',\n    'jpg': 'image/jpeg',\n    '"
  },
  {
    "path": "tests/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/async/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/async/files/file.txt",
    "chars": 5,
    "preview": "file\n"
  },
  {
    "path": "tests/async/files/index.html",
    "chars": 18,
    "preview": "<html>file</html>\n"
  },
  {
    "path": "tests/async/index.html",
    "chars": 14,
    "preview": "<html></html>\n"
  },
  {
    "path": "tests/async/test_aiohttp.py",
    "chars": 2151,
    "preview": "from unittest import mock\n\nimport yarl\nfrom aiohttp.web import Request\n\nfrom engineio.async_drivers import aiohttp as as"
  },
  {
    "path": "tests/async/test_asgi.py",
    "chars": 21417,
    "preview": "import os\nfrom unittest import mock\n\nfrom engineio.async_drivers import asgi as async_asgi\n\n\nclass TestAsgi:\n    async d"
  },
  {
    "path": "tests/async/test_client.py",
    "chars": 54141,
    "preview": "import asyncio\nimport ssl\nfrom unittest import mock\n\ntry:\n    import aiohttp\nexcept ImportError:\n    aiohttp = None\nimpo"
  },
  {
    "path": "tests/async/test_sanic.py",
    "chars": 70,
    "preview": "from engineio.async_drivers import sanic as async_sanic  # noqa: F401\n"
  },
  {
    "path": "tests/async/test_server.py",
    "chars": 49258,
    "preview": "import asyncio\nimport gzip\nimport io\nimport logging\nfrom unittest import mock\nimport zlib\n\nimport pytest\n\nfrom engineio "
  },
  {
    "path": "tests/async/test_socket.py",
    "chars": 20339,
    "preview": "import asyncio\nimport time\nfrom unittest import mock\n\nimport pytest\n\nfrom engineio import async_socket\nfrom engineio imp"
  },
  {
    "path": "tests/async/test_tornado.py",
    "chars": 2140,
    "preview": "from unittest import mock\n\ntry:\n    import tornado.web\nexcept ImportError:\n    pass\n\nfrom engineio.async_drivers import "
  },
  {
    "path": "tests/common/__init__.py",
    "chars": 0,
    "preview": ""
  },
  {
    "path": "tests/common/files/file.txt",
    "chars": 5,
    "preview": "file\n"
  },
  {
    "path": "tests/common/files/index.html",
    "chars": 18,
    "preview": "<html>file</html>\n"
  },
  {
    "path": "tests/common/index.html",
    "chars": 14,
    "preview": "<html></html>\n"
  },
  {
    "path": "tests/common/test_client.py",
    "chars": 61808,
    "preview": "import logging\nimport ssl\nimport time\nfrom unittest import mock\n\nimport pytest\nimport websocket\n\nfrom engineio import ba"
  },
  {
    "path": "tests/common/test_middleware.py",
    "chars": 7524,
    "preview": "import os\nfrom unittest import mock\n\nimport engineio\n\n\nclass TestWSGIApp:\n    def test_wsgi_routing(self):\n        mock_"
  },
  {
    "path": "tests/common/test_packet.py",
    "chars": 5080,
    "preview": "import pytest\n\nfrom engineio import packet\n\n\nclass TestPacket:\n    def test_encode_default_packet(self):\n        pkt = p"
  },
  {
    "path": "tests/common/test_payload.py",
    "chars": 2418,
    "preview": "import pytest\n\nfrom engineio import packet\nfrom engineio import payload\n\n\nclass TestPayload:\n    def test_encode_empty_p"
  },
  {
    "path": "tests/common/test_server.py",
    "chars": 47752,
    "preview": "import gzip\nimport importlib\nimport io\nimport logging\nimport sys\nimport time\nfrom unittest import mock\nimport zlib\n\nimpo"
  },
  {
    "path": "tests/common/test_socket.py",
    "chars": 19070,
    "preview": "import io\nimport time\nfrom unittest import mock\n\nimport pytest\n\nfrom engineio import exceptions\nfrom engineio import pac"
  },
  {
    "path": "tests/performance/README.md",
    "chars": 115,
    "preview": "Performance\n===========\n\nThis directory contains several scripts and tools to test the performance of\nthe project.\n"
  },
  {
    "path": "tests/performance/binary_b64_packet.py",
    "chars": 423,
    "preview": "import time\nfrom engineio import packet\n\n\ndef test():\n    p = packet.Packet(packet.MESSAGE, b'hello world')\n    start = "
  },
  {
    "path": "tests/performance/binary_packet.py",
    "chars": 411,
    "preview": "import time\nfrom engineio import packet\n\n\ndef test():\n    p = packet.Packet(packet.MESSAGE, b'hello world')\n    start = "
  },
  {
    "path": "tests/performance/json_packet.py",
    "chars": 413,
    "preview": "import time\nfrom engineio import packet\n\n\ndef test():\n    p = packet.Packet(packet.MESSAGE, {'hello': 'world'})\n    star"
  },
  {
    "path": "tests/performance/payload.py",
    "chars": 459,
    "preview": "import time\nfrom engineio import packet, payload\n\n\ndef test():\n    p = payload.Payload(\n        packets=[packet.Packet(p"
  },
  {
    "path": "tests/performance/run.sh",
    "chars": 151,
    "preview": "#!/bin/bash\npython text_packet.py\npython binary_packet.py\npython binary_b64_packet.py\npython json_packet.py\npython paylo"
  },
  {
    "path": "tests/performance/server_receive.py",
    "chars": 962,
    "preview": "import io\nimport sys\nimport time\nimport engineio\n\n\ndef test(eio_version, payload):\n    s = engineio.Server()\n    start ="
  },
  {
    "path": "tests/performance/text_packet.py",
    "chars": 408,
    "preview": "import time\nfrom engineio import packet\n\n\ndef test():\n    p = packet.Packet(packet.MESSAGE, 'hello world')\n    start = t"
  },
  {
    "path": "tox.ini",
    "chars": 712,
    "preview": "[tox]\nenvlist=flake8,py310,py311,py312,py313,py314,pypy3,docs\nskip_missing_interpreters=True\n\n[gh-actions]\npython =\n    "
  }
]

About this extraction

This page contains the full source code of the miguelgrinberg/python-engineio GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 144 files (1.2 MB), approximately 327.0k tokens, and a symbol index with 840 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!