%global _empty_manifest_terminate_build 0
Name: python-websockets
Version: 16.1
Release: 1
Summary: An implementation of the WebSocket Protocol (RFC 6455 & 7692)
License: BSD-3-Clause
URL: https://github.com/aaugustin/websockets
Source0: %{pypi_source websockets}
%description
``websockets`` is a library for building WebSocket servers_ and clients_ in
Python with a focus on correctness and simplicity.
Built on top of ``asyncio``, Python's standard asynchronous I/O framework, it
provides an elegant coroutine-based API.
`Documentation is available on Read the Docs. <https://websockets.readthedocs.io/>`_
Here's how a client sends and receives messages:
#!/usr/bin/env python
import asyncio
import websockets
async def hello(uri):
async with websockets.connect(uri) as websocket:
await websocket.send("Hello world!")
await websocket.recv()
asyncio.get_event_loop().run_until_complete(
hello('ws://localhost:8765'))
And here's an echo server:
#!/usr/bin/env python
import asyncio
import websockets
async def echo(websocket, path):
async for message in websocket:
await websocket.send(message)
asyncio.get_event_loop().run_until_complete(
websockets.serve(echo, 'localhost', 8765))
asyncio.get_event_loop().run_forever()
Does that look good?
`Get started with the tutorial! <https://websockets.readthedocs.io/en/stable/intro.html>`_
%package -n python3-websockets
Summary: An implementation of the WebSocket Protocol (RFC 6455 & 7692)
Provides: python-websockets
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: python3-cffi
BuildRequires: gcc
%description -n python3-websockets
``websockets`` is a library for building WebSocket servers_ and clients_ in
Python with a focus on correctness and simplicity.
Built on top of ``asyncio``, Python's standard asynchronous I/O framework, it
provides an elegant coroutine-based API.
`Documentation is available on Read the Docs. <https://websockets.readthedocs.io/>`_
Here's how a client sends and receives messages:
#!/usr/bin/env python
import asyncio
import websockets
async def hello(uri):
async with websockets.connect(uri) as websocket:
await websocket.send("Hello world!")
await websocket.recv()
asyncio.get_event_loop().run_until_complete(
hello('ws://localhost:8765'))
And here's an echo server:
#!/usr/bin/env python
import asyncio
import websockets
async def echo(websocket, path):
async for message in websocket:
await websocket.send(message)
asyncio.get_event_loop().run_until_complete(
websockets.serve(echo, 'localhost', 8765))
asyncio.get_event_loop().run_forever()
Does that look good?
`Get started with the tutorial! <https://websockets.readthedocs.io/en/stable/intro.html>`_
%package help
Summary: Development documents and examples for websockets
Provides: python3-websockets-doc
%description help
``websockets`` is a library for building WebSocket servers_ and clients_ in
Python with a focus on correctness and simplicity.
Built on top of ``asyncio``, Python's standard asynchronous I/O framework, it
provides an elegant coroutine-based API.
`Documentation is available on Read the Docs. <https://websockets.readthedocs.io/>`_
Here's how a client sends and receives messages:
#!/usr/bin/env python
import asyncio
import websockets
async def hello(uri):
async with websockets.connect(uri) as websocket:
await websocket.send("Hello world!")
await websocket.recv()
asyncio.get_event_loop().run_until_complete(
hello('ws://localhost:8765'))
And here's an echo server:
#!/usr/bin/env python
import asyncio
import websockets
async def echo(websocket, path):
async for message in websocket:
await websocket.send(message)
asyncio.get_event_loop().run_until_complete(
websockets.serve(echo, 'localhost', 8765))
asyncio.get_event_loop().run_forever()
Does that look good?
`Get started with the tutorial! <https://websockets.readthedocs.io/en/stable/intro.html>`_
%prep
%autosetup -n websockets-%{version}
%build
%py3_build
%install
%py3_install
install -d -m755 %{buildroot}/%{_pkgdocdir}
if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
pushd %{buildroot}
if [ -d usr/lib ]; then
find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/lib64 ]; then
find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/bin ]; then
find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst
fi
if [ -d usr/sbin ]; then
find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst
fi
touch doclist.lst
if [ -d usr/share/man ]; then
find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst
fi
popd
mv %{buildroot}/filelist.lst .
mv %{buildroot}/doclist.lst .
%files -n python3-websockets -f filelist.lst
%dir %{python3_sitearch}/*
%files help -f doclist.lst
%{_docdir}/*
%changelog
* Thu Jul 16 2026 lilu_ll <lilu@kylinos.cn> - 16.1-1
- Update package to version 16.1
* Added an option to force :func:`~asyncio.server.broadcast` to send :class:`bytes` in text frames, or :class:`str` in binary frames.
* Stripped Authorization, Cookie, and Proxy-Authorization headers when clients follow cross-origin redirects, a security hardening measure.
* Escaped control characters in incoming messages in the websockets CLI.
* Mon Jan 12 2026 YangengLiu <dev01202@linx-info.com> - 16.0-1
- update version to 16.0
* Validated compatibility with Python 3.14.
* Added support for free-threaded Python.
* Allowed setting separate limits for messages and fragments with max_size.
* Added support for HTTP/1.0 proxies.
* Added support for customizing the close code and reason for connections in Server.close.
* Prevented recv() from returning bytearray instead of bytes in edge cases.
* Fixed a race condition that could lead to an exception when closing connections in the threading implementation.
* Wed Aug 06 2025 Ge Wang <wang__ge@126.com> - 15.0.1-1
- Update package to version 15.0.1
* Prevented an exception when exiting the interactive client
* Added :func:`~asyncio.router.route` and :func:`~asyncio.router.unix_route` to dispatch connections to handlers based on the request path
* Added support for regular expressions in the origins argument of :func:`~asyncio.server.serve`
* Added HTTP Basic Auth to the new :mod:`asyncio` and :mod:`threading` implementations of servers
* Sat Feb 17 2024 xu_ping <707078654@qq.com> - 12.0-1
- Upgrade package to version 12.0
* Fri Jun 30 2023 limiaomiao_zhr <mmlidc@isoftstone.com> - 11.0.3-1
- Upgrade package to version 11.0.3
* Tue Nov 08 2022 liqiuyu <liqiuyu@kylinos.cn> - 10.4-1
- Upgrade package to version 10.4
* Wed May 11 2022 yangping <yangping69@h-partners> - 8.1-3
- License compliance rectification
* Wed Aug 04 2021 chenyanpanHW <chenyanpan@huawei.com> - 8.1-2
- DESC: delete BuildRequires gdb
* Thu Oct 01 2020 Python_Bot <Python_Bot@openeuler.org>
- Package Spec generated