Skip to main content

HTTP and Websocket both supported wsgi server

Project description

WSocket

HTTP and Websocket both supported wsgi server

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()
        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*

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

Uploaded Source

Built Distributions

WSocket-1.1.5-py3.7.egg (12.0 kB view details)

Uploaded Source

WSocket-1.1.5-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

WSocket-1.1.5-py2.7.egg (12.1 kB view details)

Uploaded Source

WSocket-1.1.5-py2-none-any.whl (9.0 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: WSocket-1.1.5.tar.gz
  • Upload date:
  • Size: 5.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.1.5.tar.gz
Algorithm Hash digest
SHA256 214b8d3a602d0e380b854d1162c439f4e3f75dbe267031674947e3e2a590e03d
MD5 9fc2ab44a9519d90b17e8365275e51fa
BLAKE2b-256 f5b15dc20ee18577d30f82c0d9f8847a81794abcb9b5c284a6d5ce58b1dc676b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.1.5-py3.7.egg
  • Upload date:
  • Size: 12.0 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.1.5-py3.7.egg
Algorithm Hash digest
SHA256 dd48a80291129d1e6d38051ae35a3ad043cd9087841298df27bed4cf89e78238
MD5 9be311a3fe20eabf6dcf1866f40822db
BLAKE2b-256 1ff86a0308a6bf9b299dca0c62b570c48b26ddda59ccfe6b64b3fd1fddcc218b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.0 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.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 65c5c09294ead02f56dc9525a49c2f0373a5d579685efdcf7232ffb125a0fb82
MD5 a7d1a58d57898b89406ee4c6daa4a00c
BLAKE2b-256 2ce7e2b2dff202c241a6ae3da0d20223f3b9dc228e414eed74f0776d82872bcf

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.1.5-py2.7.egg
  • Upload date:
  • Size: 12.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.1.5-py2.7.egg
Algorithm Hash digest
SHA256 2c8c79f2549a34cbf8952318624bc89a95d11d2d2f6eb4e826fa813d8e24dba5
MD5 b4fe782702745dd9cdcb7bc5f47658d4
BLAKE2b-256 d8feeaa96ce00d115f9e05826a275719b079f4681e65f849dd0ad4a19562ece6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.1.5-py2-none-any.whl
  • Upload date:
  • Size: 9.0 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.1.5-py2-none-any.whl
Algorithm Hash digest
SHA256 d6574ec30c3fd92d6ff945f3472f45f04d9a6df9923bacc96f98e06aeb5cd93d
MD5 14db6eab9eeeae9150a860a6f6c5d558
BLAKE2b-256 48ab3859fd3ad233bc4c1aed108ea7cf455abda0ca3c5b316982867f1d7abc3e

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