Git Product home page Git Product logo

Comments (12)

FZambia avatar FZambia commented on June 23, 2024

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.

thinkwelltwd avatar thinkwelltwd commented on June 23, 2024

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.

FZambia avatar FZambia commented on June 23, 2024

So it seems like presence data for channel then?

from pycent.

thinkwelltwd avatar thinkwelltwd commented on June 23, 2024

Yes, that's right. If there'd be an easy way to get that, it would just make my day.

from pycent.

FZambia avatar FZambia commented on June 23, 2024

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.

FZambia avatar FZambia commented on June 23, 2024

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.

thinkwelltwd avatar thinkwelltwd commented on June 23, 2024

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.

FZambia avatar FZambia commented on June 23, 2024

presence returns a dictionary with all clients currently subscribed on this channel.

from pycent.

thinkwelltwd avatar thinkwelltwd commented on June 23, 2024

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.

FZambia avatar FZambia commented on June 23, 2024

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.

thinkwelltwd avatar thinkwelltwd commented on June 23, 2024

I reviewed your code changes a bit; looks like some nice improvements & streamlining. l'll watch for your updates.

from pycent.

FZambia avatar FZambia commented on June 23, 2024

v0.5.0 released!

from pycent.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.