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

Uploaded Source

Built Distributions

WSocket-1.0.0-py3.7.egg (11.3 kB view details)

Uploaded Source

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

Uploaded Python 3

WSocket-1.0.0-py2.7.egg (11.4 kB view details)

Uploaded Source

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

Uploaded Python 2

File details

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

File metadata

  • Download URL: WSocket-1.0.0.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.0.tar.gz
Algorithm Hash digest
SHA256 f3219ba63e45a905ceeeeca24dc1530921e4171401e196ad5e4cfaa6b07d6ac6
MD5 f44a0a031c6810b08dfb8621947d2520
BLAKE2b-256 f9d5d2cd3a9f515bb8bbaf348e4c53290f5922f8c974e2eb9d9cac321966a0a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.0.0-py3.7.egg
  • Upload date:
  • Size: 11.3 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.0-py3.7.egg
Algorithm Hash digest
SHA256 6cdc93e65009ce1431a1b86ec34521d5e5f7ddc62fc5570228898eb600d1a2e5
MD5 d4c7371eeb996dc4e47a9ca715f74fe2
BLAKE2b-256 bb834da4dc4649319c6be27eecf584050e91248c79e3757c7bd4895156c0c3a3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.0.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96ded78e9e7b1e8c3ee48a9f0595fa2dc2b53df288008bdbbc3204b9360d8da2
MD5 1f51323446c7728e2335ea1f6c433f61
BLAKE2b-256 13fefadf5592c7d26f61861481437ee222b7ff9ef8c2a7fe32ce1ca0a4eaf960

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.0.0-py2.7.egg
  • Upload date:
  • Size: 11.4 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.0-py2.7.egg
Algorithm Hash digest
SHA256 bcde334288a75d091d2a7cce727857e044c0e0cd8a87f0c9c29394024ecbac8b
MD5 9c3ab6552260c0d5f2266b9ff9cd4610
BLAKE2b-256 a33d9a018bfd1c3b9f4ef685defde51895999a37589ac64351bc6d1fc62551eb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.0.0-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.0-py2-none-any.whl
Algorithm Hash digest
SHA256 f6bf9bc5cfef2bae2ea1d10982b21eb3ed551a982d65d4bdb2ab245ebcdc434c
MD5 fd29e242293de7a8ae47d3dda170dd5d
BLAKE2b-256 db0ba7930c3783beaad5b46c5b5418f06f236f8cbaae7c4859b4297b2bdcec96

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