Skip to main content

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)


```

Project details


Release history Release notifications | RSS feed

This version

1.0

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

Flask_WebSocket-0.1-py2.7.egg (3.7 kB view hashes)

Uploaded Source

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