Skip to content

Connected clients count #121

Description

@yildizsc

Hi @boazsegev,

Thanks for this great work. You deserve the best I think. Very useful tool.
My question is can I get the connected clients count like the following.

Iodine.connections.count

I have a workaround but this is not reliable like the following using redis.

class SSECallback
  CHANNEL_NAME = 'SSE'

  def initialize(client_channel_name: CHANNEL_NAME)
    @channel_name = client_channel_name
  end 
  
  def on_open(client)
    client.subscribe @channel_name
    redis.incr 'connections_count'
  end
  
  def on_close(client)
    redis.decr 'connections_count'
  end
end

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions