(self, channel_name)
return self.channels[channel_name]
Subscribe to a channel

    :param channel_name: The name of the channel to subscribe to.
    :type channel_name: str

    :rtype : Channel
Subscribe to a channel
Subscribe to a channel
def subscribe(self, channel_name):
    """Subscribe to a channel

    :param channel_name: The name of the channel to subscribe to.
    :type channel_name: str

    :rtype : Channel
    """
    data = {'channel': channel_name}

    if channel_name.startswith('presence-'):
      data['auth'] = self._generate_presence_key(
        self.connection.socket_id,
        self.key,
        channel_name,
        self.secret,
        self.user_data
      )
      data['channel_data'] = json.dumps(self.user_data)
    elif channel_name.startswith('private-'):
      data['auth'] = self._generate_private_key(
        self.connection.socket_id,
        self.key,
        channel_name,
        self.secret
      )

    self.connection.send_event('pusher:subscribe', data)

    self.channels[channel_name] = Channel(channel_name, self.connection)

    return self.channels[channel_name]
def subscribe ( self , channel_name ) : data = { 'channel' : channel_name } if channel_name . startswith ( 'presence-' ) : data [ 'auth' ] = self . _generate_presence_key ( self . connection . socket_id , self . key , channel_name , self . secret , self . user_data ) data [ 'channel_data' ] = json . dumps ( self . user_data ) elif channel_name . startswith ( 'private-' ) : data [ 'auth' ] = self . _generate_private_key ( self . connection . socket_id , self . key , channel_name , self . secret ) self . connection . send_event ( 'pusher:subscribe' , data ) self . channels [ channel_name ] = Channel ( channel_name , self . connection ) return self . channels [ channel_name ]