Skip to main content

HTTP and Websocket both supported wsgi server

Project description

WSocket

HTTP and Websocket both supported wsgi server

WSGI Server creates and listens at the HTTP socket, dispatching the requests to a handler. Code to create and run the server looks like this:
using bottle

#!/usr/bin/python
# -*- coding: utf-8 -*-
from bottle import request, Bottle
from wsgi import WebSocketHandler
from sl import *
from time import sleep

app = Bottle()

@app.route('/')
def handle_websocket():
    wsock = request.environ.get('wsgi.websocket')
    if not wsock:
        return 'Hello World!'
    while True:
        message = wsock.receive()
        print(message)
        wsock.send('Your message was: %r' % message)
        sleep(3)
        wsock.send('Your message was: %r' % message)

def make_server(application):
    server = ThreadingWSGIServer(('', 9001), WebSocketHandler)
    server.set_app(application)
    return server

httpd = make_server(app)
print('WSGIServer: Serving HTTP on port 9001 ...\n')
try:
    httpd.serve_forever()
except:
    print('WSGIServer: Server Stopped')

run this code download client.html file open it with browser see how it works! then navigate to http://localhost:9001 You can see Hello World!

Features

  • the power of websocket
  • fast ( It's very fast )
  • simple
  • lightweight (simple and lightweight )
  • WSGI ( supports web server gateway interface )
  • with web frameworks (any WSGI framework supported)

Flask, Django, Pyramid, Bottle supported

View Documentaion*

License

Code and documentation are available according to the MIT License (see LICENSE).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

WSocket-1.0.3.tar.gz (5.6 kB view details)

Uploaded Source

Built Distributions

WSocket-1.0.3-py3.7.egg (11.5 kB view details)

Uploaded Source

WSocket-1.0.3-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

WSocket-1.0.3-py2.7.egg (11.5 kB view details)

Uploaded Source

WSocket-1.0.3-py2-none-any.whl (8.6 kB view details)

Uploaded Python 2

File details

Details for the file WSocket-1.0.3.tar.gz.

File metadata

  • Download URL: WSocket-1.0.3.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/2.7.16

File hashes

Hashes for WSocket-1.0.3.tar.gz
Algorithm Hash digest
SHA256 ab6c5641c2c0fd33b6470a5ad4971130df528c30e5981875543bfa34f7e3338d
MD5 7ddc5a25ea2f1486d3c20f78e7a1bd5b
BLAKE2b-256 a11b6f6e348b02ac5d7ff91e21015e90c665ce0b8708165720836a51333494a3

See more details on using hashes here.

File details

Details for the file WSocket-1.0.3-py3.7.egg.

File metadata

  • Download URL: WSocket-1.0.3-py3.7.egg
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/2.7.16

File hashes

Hashes for WSocket-1.0.3-py3.7.egg
Algorithm Hash digest
SHA256 1dfc34dd0e852e8fd925f6c754b332799082b0249a802e3683790b3960fdcf2f
MD5 77571dc2edb768b5560313f4312bc5d8
BLAKE2b-256 95865778cdcb7eb747e1a5ef3a3ee05745e3642b9e2e833f8389be8752e49b61

See more details on using hashes here.

File details

Details for the file WSocket-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: WSocket-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/2.7.16

File hashes

Hashes for WSocket-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 58f073aad881c8f1b482a55e652178668d7f2d870651b004ea77d18a9c3a3832
MD5 c7459dfe52c0955db3f4db172a240846
BLAKE2b-256 96959dc8dd345f77bf190f436517f8b23e9081d962ed95e3e992c6d42f007b9e

See more details on using hashes here.

File details

Details for the file WSocket-1.0.3-py2.7.egg.

File metadata

  • Download URL: WSocket-1.0.3-py2.7.egg
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/2.7.16

File hashes

Hashes for WSocket-1.0.3-py2.7.egg
Algorithm Hash digest
SHA256 6957e8273509d3581f2f85b202a594323207376f38d6a9ab7ba0fd7acaa86a58
MD5 0edf7ee79a65ed95bf9cafe3bf1a0fbf
BLAKE2b-256 b43d615fdf5f515c31c4f9e497c5abe6838d817c6d5915f3fb5a3251e89cf2f0

See more details on using hashes here.

File details

Details for the file WSocket-1.0.3-py2-none-any.whl.

File metadata

  • Download URL: WSocket-1.0.3-py2-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/2.7.16

File hashes

Hashes for WSocket-1.0.3-py2-none-any.whl
Algorithm Hash digest
SHA256 0bba21717b5b9f8a545cf8d58a116d85a00efb6e4ed19d81bdb926a7bf8894bb
MD5 1d7ee92c66d3dac4671f2d117fd56ab5
BLAKE2b-256 2be7d6a564b4fbd1a540d9c867999d7a20c81a7c173c5612b733eccdcbd27859

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page