Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
PyPy3
and CPython
Middlewares
Templates
Support (examples with Mako
and Jinja2
)ASGI Server
WSGI Server
Plugins/Extensions
HPy
integration to better support CPython
, PyPy
and GraalPython
We created and adapted the full C API from uNetworking/uWebSockets and will integrate libuv powered fetch and file IO, this same C API is used by Bun
Join Github Discussions
or Discord
for help and have a look at the development progress.
Socketify WebFramework HTTP requests per second (Linux x64)
WSGI Server requests per second (Linux x64)
ASGI Server requests per second (Linux x64)
WebSocket messages per second (Linux x64)
Http tested with TFB tool plaintext benchmark
WebSocket tested with Bun.sh bench chat-client
Source code in TechEmPower and for websockets in bench
Machine OS: Debian GNU/Linux bookworm/sid x86_64 Kernel: 6.0.0-2-amd64 CPU: Intel i7-7700HQ (8) @ 3.800GHz Memory: 32066MiB
For macOS x64 & Silicon, Linux x64, Windows
pip install socketify
#or specify PyPy3
pypy3 -m pip install socketify
#or in editable mode
pypy3 -m pip install -e socketify
Using install via requirements.txt
socketify
pip install -r ./requirements.txt
#or specify PyPy3
pypy3 -m pip install -r ./requirements.txt
If you are using linux or macOS, you may need to install libuv and zlib in your system
macOS
brew install libuv
brew install zlib
Linux (Ubuntu/Debian)
apt install libuv1 zlib1g
Linux (RHEL/OEL)
yum install cmake zlib-devel libuv-devel
Hello world app
from socketify import App
app = App()
app.get("/", lambda res, req: res.end("Hello World socketify from Python!"))
app.listen(3000, lambda config: print("Listening on port http://localhost:%d now\n" % config.port))
app.run()
SSL version sample
from socketify import App, AppOptions
app = App(AppOptions(key_file_name="./misc/key.pem", cert_file_name="./misc/cert.pem", passphrase="1234"))
app.get("/", lambda res, req: res.end("Hello World socketify from Python!"))
app.listen(3000, lambda config: print("Listening on port http://localhost:%d now\n" % config.port))
app.run()
WebSockets
from socketify import App, OpCode, CompressOptions
def ws_open(ws):
print('A WebSocket got connected!')
ws.send("Hello World!", OpCode.TEXT)
def ws_message(ws, message, opcode):
#Ok is false if backpressure was built up, wait for drain
ok = ws.send(message, opcode)
app = App()
app.ws("/*", {
'compression': CompressOptions.SHARED_COMPRESSOR,
'max_payload_length': 16 * 1024 * 1024,
'idle_timeout': 12,
'open': ws_open,
'message': ws_message,
'drain': lambda ws: print(f'WebSocket backpressure: {ws.get_buffered_amount()}'),
'close': lambda ws, code, message: print('WebSocket closed'),
'subscription': lambda ws, topic, subscriptions, subscriptions_before: print(f'subscribe/unsubscribe on topic {topic} {subscriptions} {subscriptions_before}'),
})
app.any("/", lambda res,req: res.end("Nothing to see here!'"))
app.listen(3000, lambda config: print("Listening on port http://localhost:%d now\n" % (config.port)))
app.run()
We have more than 20 examples click here for more
#clone and update submodules
git clone https://github.com/cirospaciari/socketify.py.git
cd ./socketify.py
git submodule update --init --recursive --remote
#you can use make linux, make macos or call Make.bat from Visual Studio Development Prompt to build
cd ./src/socketify/native/ && make linux && cd ../../../
#install local pip
pypy3 -m pip install .
#install in editable mode
pypy3 -m pip install -e .
#if you want to remove
pypy3 -m pip uninstall socketify
I'm a Brazilian consulting & contracting company dealing with anything related with socketify.py and socketify.rb
Don't hesitate sending a mail if you are in need of advice, support, or having other business inquiries in mind. We'll figure out what's best for both parties.
Special thank's to uNetworking AB to develop uWebSockets, uSockets and allow us to bring this features and performance to Python and PyPy
If you like to see this project thrive, you can sponsor us on GitHub too. We need all the help we can get.
Thank you Otavio Augusto
to be the first sponsor of this project!
We don't use uvloop, because uvloop don't support Windows and PyPy3 at this moment, this can change in the future, but right now we want to implement our own libuv + asyncio solution, and a lot more.
Cython performs really well on Python3 but really bad on PyPy3, CFFI are chosen for better support PyPy3 until we got our hands on a stable HPy
integration.
FAQs
Bringing WebSockets, Http/Https High Performance servers for PyPy3 and Python3
We found that socketify demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.