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

Uploaded Source

Built Distributions

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

Uploaded Source

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

Uploaded Python 3

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

Uploaded Source

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

Uploaded Python 2

File details

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

File metadata

  • Download URL: WSocket-1.3.8.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.8.tar.gz
Algorithm Hash digest
SHA256 515c3cf3e72bbf6c585404309df7a9278b7a9c31b55b7a595d75fb9df36d7e54
MD5 7f3b1306dab567146f5f106d9cc3e1ac
BLAKE2b-256 72a4ed73992afe17157d5b70b6039442d421fc6201b0f934a0ef5d30bdd21123

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.3.8-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.8-py3.7.egg
Algorithm Hash digest
SHA256 ee55ae6da9bfaf88c8a804d322d0b78c9fcf503cdde39f7be1fd3e408955e962
MD5 c048acce3759dab723a778933674eead
BLAKE2b-256 2d99dd72333e607c240e6e703dbc12574db3a7d23e5c554b8d7d55b22fa65ac7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.3.8-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.8-py3-none-any.whl
Algorithm Hash digest
SHA256 3aee21a92ac72e4d5da842ef4a587c81eb0d09cb650d196d1b3b46794ec53895
MD5 a73fa6a3119d146b7486eddd6138be3c
BLAKE2b-256 4ecfb0c24cdb7751a9f837b158d5bdc005c5c54b9e55dd8bab7dfdaf103546a0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.3.8-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.8-py2.7.egg
Algorithm Hash digest
SHA256 477c287fe12ad5dd1623d00b11fbf3bc07945a0b8f0f4748369d8b269902e967
MD5 c0d148bdcc3d77bc8d85da30cc0938a5
BLAKE2b-256 e161e48f370f77a3b4b13b0c84603524cfd7129ba7330d2790bf26a4c0357f33

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.3.8-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.8-py2-none-any.whl
Algorithm Hash digest
SHA256 660b4955e25cdc1890b43959bfd6239d797a2486f12b4288298b147a99467e13
MD5 b79c16fb71553b99f1a917d8175e6ac2
BLAKE2b-256 99d8a4aa32c853a0457b4de3b92400e1638a19d23aa0431a9799c8a8063034af

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