kopia lustrzana https://github.com/cirospaciari/socketify.py
5.6 KiB
5.6 KiB
📚 Examples
All examples are located in the examples
directory.
🚀 Getting Started
hello_world.py
- Basic HTTP server setuphello_world_cli.py
- Command-line interface examplehello_world_cli_ws.py
- CLI with WebSocket supporthello_world_unix_domain.py
- Unix domain socket example
🔒 Security & HTTPS
https.py
- HTTPS server with SSL/TLS configuration
🌐 WebSocket Examples
websockets.py
- Basic WebSocket implementationws_close_connection.py
- WebSocket connection managementchat/
- Real-time chat applicationbroadcast.py
- Broadcasting messages to multiple clientsbackpressure.py
- Handling WebSocket backpressure
⚙️ Middleware & Routing
middleware.py
- Basic middleware implementationmiddleware_async.py
- Asynchronous middlewaremiddleware_sync.py
- Synchronous middlewaremiddleware_router.py
- Router-based middlewarerouter_and_basics.py
- Routing fundamentals
🔄 Async/Sync Programming
async.py
- Asynchronous request handlingupgrade.py
- Protocol upgrade examplesupgrade_async.py
- Asynchronous protocol upgrades
📁 File Handling & Static Content
static_files.py
- Serving static filesfile_stream.py
- File streaming capabilitiesupload_or_post.py
- File uploads and POST data handling
🎨 Template Engines
template_jinja2.py
- Jinja2 template integrationtemplate_mako.py
- Mako template integrationtemplates/
- Template examples and resources
🛠️ Advanced Features
custom_json_serializer.py
- Custom JSON serializationhttp_request_cache.py
- HTTP request cachingproxy.py
- Proxy server implementationautomatic_port_selection.py
- Dynamic port selection
🔧 Server Configuration
listen_options.py
- Server listening optionsgraceful_shutdown.py
- Graceful server shutdownforks.py
- Multi-process server setup
📊 GraphQL Integration
graphiql.py
- GraphiQL interface setupgraphiql_raw.py
- Raw GraphQL implementation
🐳 Development & Deployment
docker/
- Docker containerization examplesrequirements.txt
- Example dependencies
🛡️ Error Handling & Logging
error_handler.py
- Error handling strategiesbetter_logging.py
- Advanced logging setupnot_found.py
- Custom 404 error pages
🔨 Utilities & Helpers
helpers/
- Utility functions and helper modules