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)

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

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

Uploaded Source

Built Distributions

WSocket-1.2.8-py3.7.egg (13.1 kB view details)

Uploaded Source

WSocket-1.2.8-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

WSocket-1.2.8-py2.7.egg (13.1 kB view details)

Uploaded Source

WSocket-1.2.8-py2-none-any.whl (12.6 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: WSocket-1.2.8.tar.gz
  • Upload date:
  • Size: 6.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.2.8.tar.gz
Algorithm Hash digest
SHA256 a193eb6783505a163eb514a9562a0336d38e7cd4bb6b889961a19699d9a44d14
MD5 a9153fb064533fa869e89f65f5fd07a0
BLAKE2b-256 c5d462eca9c415212e3fa77c6c51248637ab71689e9bf4c0480332ad09ca83f3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.2.8-py3.7.egg
  • Upload date:
  • Size: 13.1 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.2.8-py3.7.egg
Algorithm Hash digest
SHA256 24c0bbac40c03234a5c8f66a3aeee649dcb0299c8db9ba8eb9c2f116224194ff
MD5 f7ff02c3ec99420669dfa2e3bb2f3f56
BLAKE2b-256 514e33880852d0dbffb6e100fb5df4efde5646cd8e59290d618c90476a205596

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.2.8-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 6042ad28d06d3335573e02643c3beda5dc718ea763a1b1a2fe9cf233adf837a3
MD5 32569727338a0f900abb039968196eec
BLAKE2b-256 b94a13e1dd676f3d40c297cd2fd88f2cea8903e6a66ecd4f3974498e9ee2fa9b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.2.8-py2.7.egg
  • Upload date:
  • Size: 13.1 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.2.8-py2.7.egg
Algorithm Hash digest
SHA256 d3c29a1c106e09297b7a3372ee3f0f241946483baf28a4f7d501810426f6adb8
MD5 8e8f5abd4062255f5dbb79ccb745c794
BLAKE2b-256 a513794da3d9a4e0a2e40333d21a8193e8c4c79f4144c5fd29a13014ba53e7ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.2.8-py2-none-any.whl
  • Upload date:
  • Size: 12.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.2.8-py2-none-any.whl
Algorithm Hash digest
SHA256 d7d2eba739bd7c10cfd1cea5fe1c89710f990b31c5f6138211b5f3eb3610f50b
MD5 0a623104718b41317e9089dd8626a820
BLAKE2b-256 9b815e54ffd1c4737151978197208de40d7f154618cfa90da34a6148c4efa03b

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