simple websocket for Flask
Project description
# Flask-WebSocket
copyright: (c) 2017 by Damon Chen.
license: BSD, see LICENSE for more details.
simple websocket for Flask
## Install
pip install flask-websocket
## Usage
you must define message with the follow message if you use on decorator:
```
{
"event": event for listen
"data": the event happend with dtaa
}
```
```python
from flask import Flask
from flask_websocket import WebSocket
app = Flask(__name__)
ws = WebSocket(app)
@ws.on('click')
def click(data):
print(data)
```
or you could process raw message by yourself.
```python
from flask import Flask
from flask_websocket import WebSocket
app = Flask(__name__)
ws = WebSocket(app)
@ws.on_raw_message
def raw_message_handler(message):
print(message)
```
copyright: (c) 2017 by Damon Chen.
license: BSD, see LICENSE for more details.
simple websocket for Flask
## Install
pip install flask-websocket
## Usage
you must define message with the follow message if you use on decorator:
```
{
"event": event for listen
"data": the event happend with dtaa
}
```
```python
from flask import Flask
from flask_websocket import WebSocket
app = Flask(__name__)
ws = WebSocket(app)
@ws.on('click')
def click(data):
print(data)
```
or you could process raw message by yourself.
```python
from flask import Flask
from flask_websocket import WebSocket
app = Flask(__name__)
ws = WebSocket(app)
@ws.on_raw_message
def raw_message_handler(message):
print(message)
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file Flask_WebSocket-0.1-py2.7.egg
.
File metadata
- Download URL: Flask_WebSocket-0.1-py2.7.egg
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8433e5384931565dca8bf812782237243291adcdc6244bd992a8876d2ce668c2 |
|
MD5 | 801ddc5ae3c9d78a8db6305d669f3747 |
|
BLAKE2b-256 | f53e3a81658b0884c92e3e1cb8f8c7bfc5c2928f877b47b4b5534ecf2485d873 |