Skip to main content

HTTP and Websocket both supported wsgi server

Project description

WSocket

HTTP and Websocket both supported wsgi server

Note: I am a student.I have no enough knowladge. So can anyone help me to develop this?

Downloads

Server(WSGI) creates and listens at the HTTP socket, dispatching the requests to a handler. this is only use standard python libraries. also: this is a plugin to ServerLight Framework.

for a better experiense install servelight

###Code to create and run the server looks like this:
using bottle(install bottle before try) ref: bottlepy

#!/usr/bin/python
# -*- coding: utf-8 -*-
from bottle import request, Bottle
from wsocket import WebSocketHandler, WebSocketError
from wsgiref.simple_server import make_server
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:
        try:
            message = wsock.receive()
            print(message)
            wsock.send('Your message was: %r' % message)
            sleep(3)
            wsock.send('Your message was: %r' % message)
        except WebSocketError:
            break        


httpd = make_server('localhost',9001,app,handler_class=WebSocketHandler)
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* report bugs

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

Uploaded Source

Built Distributions

WSocket-1.3.9-py3.7.egg (15.2 kB view details)

Uploaded Source

WSocket-1.3.9-py3-none-any.whl (11.2 kB view details)

Uploaded Python 3

WSocket-1.3.9-py2.7.egg (15.3 kB view details)

Uploaded Source

WSocket-1.3.9-py2-none-any.whl (11.2 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: WSocket-1.3.9.tar.gz
  • Upload date:
  • Size: 7.8 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.3.9.tar.gz
Algorithm Hash digest
SHA256 8060c20dbbd12c2edad19f8e7582e3d9ae14d0da8c114b5cc84d7de7d8a13f1f
MD5 62cb4dbd45e330572f7361b0a9a0d9b5
BLAKE2b-256 1d937772829e50b43e3dacfb17d6e4337148c0f8c1333201dfc46d3d54a48dab

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.3.9-py3.7.egg
  • Upload date:
  • Size: 15.2 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.3.9-py3.7.egg
Algorithm Hash digest
SHA256 5b9a106940304fdfa87999febe18fd4d5558985d5d030cf7feb80bcfb09b2c00
MD5 2ee4c02c111b2a5cdb5fb590d7b283bd
BLAKE2b-256 73abc49dcd1d1c3f9c4822dde72c98b3170b74af2769fe0b457426da29f8debd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.3.9-py3-none-any.whl
  • Upload date:
  • Size: 11.2 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.3.9-py3-none-any.whl
Algorithm Hash digest
SHA256 de70d548f6e416d52af72435c94c390a0091328dc7bff119100dfab6702ae964
MD5 025163d5a26bd69e71dd01509f61485b
BLAKE2b-256 6b2afb5867b4d89a78e2250a3eb0e3600a288ff90ea1588d3952df4e6b015df8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.3.9-py2.7.egg
  • Upload date:
  • Size: 15.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.3.9-py2.7.egg
Algorithm Hash digest
SHA256 431a16a3546c4432c4f666a0453e05b8df8159cb38d377725ddcfbc1c541ad45
MD5 2c2f609eea68afb7c93a97c72d901760
BLAKE2b-256 daac27a7f40271563d2f4a13848c74d59023439a5517127d6f0e41fa319389a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.3.9-py2-none-any.whl
  • Upload date:
  • Size: 11.2 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.3.9-py2-none-any.whl
Algorithm Hash digest
SHA256 dd6e5becc0349916316b70c1dc8f0c3edca89b6d0ef9c7b451f22a87d00804e8
MD5 1017e0d7bf7617188dab0fedd2311d6c
BLAKE2b-256 f30e96f6d99fb3981d34974c4edc12b7a43d73d6b659bed123906a98ba734430

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