Skip to main content

socket.io-python-emitter

https://travis-ci.org/ziyasal/socket.io-python-emitter.svg?branch=master https://img.shields.io/pypi/v/socket.io-emitter.svg https://codecov.io/gh/ziyasal/socket.io-python-emitter/branch/master/graph/badge.svg

A Python implementation of socket.io-emitter.

socket.io provides a hook point to easily allow you to emit events to browsers from anywhere so socket.io-python-emitter communicates with socket.io servers through redis.

We made some changes, compatible socket.io-redis 0.2.0 and socket.io 0.1.4.

How to use

Install via pip

pip install socket.io-emitter

from socket_io_emitter import Emitter

io=Emitter({'host': 'localhost', 'port':6379})
io.Emit('broadcast event','Hello from socket.io-python-emitter')

API

Emitter(opts)

The following options are allowed:

  • client: is a redis-py compatible client

    This argument is optional.

  • key: the name of the key to pub/sub events on as prefix (socket.io)

  • host: host to connect to redis on (localhost)

  • port: port to connect to redis on (6379)

If you don’t want to supply a redis client object, and want socket.io-python-emitter to initialize one for you, make sure to supply the host and port options.

Specifies a specific room that you want to emit to.

Emitter#In(room):Emitter

io=Emitter({'host': 'localhost', 'port':6379})
io.In("room-name").Emit("news","Hello from python emitter");

Emitter#To(room):Emitter

io=Emitter({'host': 'localhost', 'port':6379})

io.To("room-name").Emit("news","Hello from python emitter");

We are flattening the room parameter from [] and *argv, so you can also send to several rooms like this (both examples are valid).

io=Emitter({'host': 'localhost', 'port':6379})

io.To(["room1", "room2"]).Emit("news","Hello from python emitter");
io.To("room1", "room2").Emit("news","Hello from python emitter");

Emitter#Of(namespace):Emitter

Specifies a specific namespace that you want to emit to.

io=Emitter({'host': 'localhost', 'port':6379})

io.Of("/nsp").In("room-name").Emit("news","Hello from python emitter");

License

MIT License

Copyright (c) 2014 Ziya SARIKAYA

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.

Open Source Projects in Use

@ziλasal & @abdullahselek

Release files for socket.io-emitter 0.1.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for socket.io-emitter 0.1.5.1
File Interpreter ABI Platform
socket.io_emitter-0.1.5.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Release files / socket.io_emitter-0.1.5.1-py2.py3-none-any.whl

Download URL socket.io_emitter-0.1.5.1-py2.py3-none-any.whl
Size 6.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e2c245195a100db79edc5bacbab5ba261c1a449ec5d1849296f93d48690f3028
BLAKE2b-256 checksum
How to use checksums
7ce7c432970aaaf85158f39e013afec587031bae1ee8de2ced7e4bbf779ee610
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.5.1 This release

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page