Skip to main content

HTTP and Websocket both supported wsgi server

Project description

WSocket

HTTP and Websocket both supported wsgi server

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

Uploaded Source

Built Distributions

WSocket-1.2.7-py3.7.egg (13.8 kB view details)

Uploaded Source

WSocket-1.2.7-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

WSocket-1.2.7-py2.7.egg (13.8 kB view details)

Uploaded Source

WSocket-1.2.7-py2-none-any.whl (10.0 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: WSocket-1.2.7.tar.gz
  • Upload date:
  • Size: 6.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.2.7.tar.gz
Algorithm Hash digest
SHA256 d84951ce3b3c9e2ec85fa7311c36ab66cc50827377b5128687dcd2dbb96e8141
MD5 259f0df9bcb8250ca1f847d235bf3d77
BLAKE2b-256 0e22fbcd18907eb5e9c65c677fb89a1d6a512ef5e4d4c9c8bdf684375373e5a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.2.7-py3.7.egg
  • Upload date:
  • Size: 13.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.2.7-py3.7.egg
Algorithm Hash digest
SHA256 772fbfe86a0cca9eb9e78911a6886a598bbac59ea7fb1a06ab2f0a497a5ad87f
MD5 723291c5d574ec61fc347f890e615016
BLAKE2b-256 053b53202f07c9ae81739cc398b6f40bbab909725cd70d1a43bcda559492d42a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.2.7-py3-none-any.whl
  • Upload date:
  • Size: 10.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.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 ec3042548d6ea8dbd6c45751263022b65d7c604fd19abe0890367f38273b9d9e
MD5 a1c64790dada1551ae93b318d7872975
BLAKE2b-256 3af97106379bdb479c4b0860be83871360a7b75ad44e63b25bb497feb0d6b607

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.2.7-py2.7.egg
  • Upload date:
  • Size: 13.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.2.7-py2.7.egg
Algorithm Hash digest
SHA256 29cc1e73ac742aa519339a1f931cccfded2211c974e1ffd63f66368736c99d3a
MD5 12bb9589399d7d8569841701519c326f
BLAKE2b-256 daeb987ad96dd1049fbc97ad5e7cfbeb1ab04b954afbe62fd0bd4f72a17f9e56

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.2.7-py2-none-any.whl
  • Upload date:
  • Size: 10.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.2.7-py2-none-any.whl
Algorithm Hash digest
SHA256 d95d097985d55f107e4e05307638a877c99a001b25c795e1fcb08d788302c2e7
MD5 0f1156cf2d4a210f6db43770540173f4
BLAKE2b-256 81bcbae10eda68732c0577af44d8d919c6dfb597d603371a4418e1ec6ae56586

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