Comments (12)
Hello, yes, Cent does not support this. There is an endpoint /info/
that web interface uses to get current server stats including how many clients total connected but it's not exposed to HTTP API. Could you explain a little more detailed why you need this?
from pycent.
I have a process that sends logging info to the browser via websockets. The process is launched via supervisor in the Django View if it's not already running. But when all clients have left the channel, then I'd like to kill the process. But I only want to do it when I can be sure that there are no users left in the channel (except for the client that's publishing the logs to the channel, of course).
So that's what I had in mind.
from pycent.
So it seems like presence
data for channel then?
from pycent.
Yes, that's right. If there'd be an easy way to get that, it would just make my day.
from pycent.
https://github.com/centrifugal/adjacent/blob/master/adjacent/client.py#L36
or just:
client.add('presence', {
'channel': 'your_channel'
})
result, error = client.send()
Note that to get presence it must be enabled for channel in project options in configuration file
from pycent.
I also want to add publish
, history
, presence
methods directly to Client
class in cent
like in adjacent
client, will make it as soon as I get time for it.
from pycent.
I might be misunderstanding you. I need the count of clients present in a channel. Doesn't the presence
method just add a client?
from pycent.
presence
returns a dictionary with all clients currently subscribed on this channel.
from pycent.
Enlightenment! I must have had my presence
settings incorrect. I'm now getting a dict with clients. Thanks so much for your assistance and this excellent project.
from pycent.
You are welcome! I just pushed some new methods to commands
branch in this repo, there are new methods to simplify sending API commands, will test a little all changes during this week and will release new version with them.
from pycent.
I reviewed your code changes a bit; looks like some nice improvements & streamlining. l'll watch for your updates.
from pycent.
v0.5.0 released!
from pycent.
Related Issues (20)
- Python 3.3 Error HOT 2
- Publish by user
- Documentation HOT 4
- Introduce insecure skip verify option HOT 1
- How would I go about reading the API constantly? HOT 12
- Latest version does not work with v1 HOT 2
- Generate token for client side HOT 6
- Fix getting history HOT 2
- Missing Parameters HOT 2
- publish data with datetime or Decimal HOT 7
- Centrifugo on Production Server HOT 6
- is this client still receiving updates? HOT 8
- 404 on message publish HOT 2
- Get offset instead of publications for offset field in history response HOT 2
- Request for cent Package Availability in Anaconda
- JSONDecodeError: Expecting value: line 1 column 1 (char 0) HOT 4
- [Question] Broadcast method input parameters HOT 2
- Add license please HOT 1
- Use X-API-Sign header to set sign and POST commands in request body
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pycent.