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.4.tar.gz (5.6 kB view details)

Uploaded Source

Built Distributions

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

Uploaded Source

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

Uploaded Python 3

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

Uploaded Source

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

Uploaded Python 2

File details

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

File metadata

  • Download URL: WSocket-1.0.4.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.4.tar.gz
Algorithm Hash digest
SHA256 39f430316c88c8a07d70e05be591bdb12a2c7634de112cb73434945f0eb037a8
MD5 b4dba686b4d7cc21598de2ce7d91689b
BLAKE2b-256 cb4823961c4988b1d1156f11027821f4bee85adef120693af688f21e356ad15c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.0.4-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.4-py3.7.egg
Algorithm Hash digest
SHA256 d6f9ab186537cd912d4011efe8f2cfe8b71be2a451a8e5957a450bc812116279
MD5 a5e1e2bd9202a2f8f7f8f4fa9872c7e9
BLAKE2b-256 aab5591db2fb38c6aa33c4ea8ce7a468a6a1d158bb5995b0e3b68afb08f3fdc5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.0.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2bcec3fe773d37501123010e52cafeb1580979b4bbcbfd08896609d5871d330f
MD5 00116c7ff832ada786117a748154e6be
BLAKE2b-256 8cb0544bb1582815f2b69b18161bdebcc1e29b9089275c63fe516b1eee18669c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.0.4-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.4-py2.7.egg
Algorithm Hash digest
SHA256 cad26823b7fab095d3b67a3015fba8ecd1d04eb6e74b1e8bb54a31a264d7ffc3
MD5 363cb3031cc1a2f66b0ec371aff23b42
BLAKE2b-256 78807377a44df7acccd9375b77e62d18a099195cc3678f48dc4ff04866e1cbb0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.0.4-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.4-py2-none-any.whl
Algorithm Hash digest
SHA256 fa3b3838b5939c45711e1de43925dc9832fad84b501a16cece464359b8146f91
MD5 d6b377a421b7b594fcf59be7215be0ca
BLAKE2b-256 6f9bbae92dce9c38f7bc05b51c1fe605ff7dd390d3181e7cd566eb709ab7bc26

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