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

Uploaded Source

Built Distributions

WSocket-1.1.6-py3.7.egg (12.8 kB view details)

Uploaded Source

WSocket-1.1.6-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

WSocket-1.1.6-py2.7.egg (12.8 kB view details)

Uploaded Source

WSocket-1.1.6-py2-none-any.whl (9.4 kB view details)

Uploaded Python 2

File details

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

File metadata

  • Download URL: WSocket-1.1.6.tar.gz
  • Upload date:
  • Size: 6.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.6.tar.gz
Algorithm Hash digest
SHA256 308e16f6a2606c23a1f9b4f2454716079f9f1a07234bdefaf659d8b0caaca705
MD5 672b77345fff3e818dfa666bb058458d
BLAKE2b-256 035eb1b6fe6097c23f9959cb7384a1c98ee83f9bc48c91441a281851dee7a0a4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.1.6-py3.7.egg
  • Upload date:
  • Size: 12.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.6-py3.7.egg
Algorithm Hash digest
SHA256 bb675327cce487355fbcc2bfc1f525fc8e33b476d59ffeb7f036a310444c61e8
MD5 e2da250aaed564096ef0e597dccf7937
BLAKE2b-256 2c40aac6f6303bf6afd68b71aba75e5e0b238bd3391cc37ccdbacc53380acb5a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.1.6-py3-none-any.whl
  • Upload date:
  • Size: 9.4 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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 066c44ee15708171df963ddf79a4410078aeb39f93ea1898717297e65a054ed1
MD5 acb9e970179e8f31dcc8c7a11ca344ec
BLAKE2b-256 3aae49b990541fa7aafc3a8e371864424806a2fd96033cabbe75365279e12c9f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.1.6-py2.7.egg
  • Upload date:
  • Size: 12.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.6-py2.7.egg
Algorithm Hash digest
SHA256 3488e531b3d22b2df2eb634f849ffec7ef3a9786196f34e4d56dd9df9d46614a
MD5 35441681397cff069ab20c755ff47c8d
BLAKE2b-256 5baa39fd011c9c9f8ae24a53c736cfa2f9d07b7c02457782e99ce0925180ba0b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: WSocket-1.1.6-py2-none-any.whl
  • Upload date:
  • Size: 9.4 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.6-py2-none-any.whl
Algorithm Hash digest
SHA256 b1f6b2aa17c5bf53bec056a163825c7ccdce990b7f81f0a07945cedf5d02c0dd
MD5 12ed1029fd5aedf0f6ad127c338834b9
BLAKE2b-256 eb41b51d1e1a509c99671b64a9c7fd4dba77b8284a2c05539c6a815179a5cb86

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