socket.io-announce in Python
Lightweight infrastructure broadcast for use with Socket.io RedisStore. This was ported from dshaw/socket.io-announce a Node.js project. Thanks to @dshaw.
Install
pip install socket.io-announce
Use anywhere in your stack, independent of other socket.io servers.
from announce import Announce
announce = Announce()
announce.emit('status', {'msg': 'Going down for maintenance in 15 minutes', 'countdown': 10000})
Emit to all users.
announce.send('Hello, world!')
announce.emit('quote', {'symbol':'APPL', 'price': 5000})
Target socket.io rooms.
announce.send('Yoyo yo!', room='boardroom')
announce.emit('tweet', {'id': '1', 'user': '@dshaw', 'text': 'Keeping things small...'}, room='nodeup')
Target socket.io namespaces (with rooms too).
announce = Announce(namespace='/namespace')
announce.emit('episode', {'url': 'http://www.nodeup.com/twentyfour'}, room='nodeup')
Custom JSON Serialization
If you run into JSON errors trying to serialize data types like date/time/timedelta, decimal, generators, or any other that is not supported by the standard json library, you’ll probably need to use a custom JSONEncoder.
def custom_json_dumps(data):
return json.dumps(data, cls=CustomJSONEncoder)
announce = Announce(namespace='/namespace', json_dumps=custom_json_dumps)
announce.emit('episode', {'date': datetime.datetime.today()}, room='nodeup')
License
(The MIT License)
Copyright (c) 2014 Blimp LLC - Giovanni Collazo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Metadata
Release files for socket.io-announce 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| socket.io-announce-0.0.5.tar.gz | 5.6 kB | Without provenance | Details for socket.io-announce-0.0.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| socket.io_announce-0.0.5-py27-none-any.whl | Python 2.7 | none | any | Details for socket.io_announce-0.0.5-py27-none-any.whl |
Total release size: 13.4 kB
Release files / socket.io-announce-0.0.5.tar.gz
| Download URL | socket.io-announce-0.0.5.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4bbb459387a35b28b88c883818b40b897cd973105098f0cb556d072120c36da2
|
|
BLAKE2b-256 checksum How to use checksums |
377a9cebc6623cac15761591548b2d8cd00031eaf9bd07c28f85a568206937b0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / socket.io_announce-0.0.5-py27-none-any.whl
| Download URL | socket.io_announce-0.0.5-py27-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 2.7 |
|
SHA-256 checksum How to use checksums |
690d9d40481422aac8d54d885e622d2b6b1b694cb15913e5abaa662d8ccf028e
|
|
BLAKE2b-256 checksum How to use checksums |
9396e90ee55d98ff4e00185bcb3db430f7e7a01333a8a8281d55caa1bfc9c65f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for socket.io-announce 0.0.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.