Channels connection setup.
    Register the current client on the related Group according to the language
973451
def ws_connect(message):
    
    prefix, language = message['path'].strip('/').split('/')
    gr = Group('knocker-{0}'.format(language))
    gr.add(message.reply_channel)
    message.channel_session['knocker'] = language
    message.reply_channel.send({"accept": True})
1293500
def bind(self, queue, exchange, routing_key='', nowait=True, arguments={},
             ticket=None, cb=None):
        '''
        
        '''
        nowait = nowait and self.allow_nowait() and not cb

        args = Writer()
        args.write_short(ticket or self.default_ticket).\
            write_shortstr(queue).\
            write_shortstr(exchange).\
            write_shortstr(routing_key).\
            write_bit(nowait).\
            write_table(arguments)
        self.send_frame(MethodFrame(self.channel_id, 50, 20, args))

        if not nowait:
            self._bind_cb.append(cb)
            self.channel.add_synchronous_cb(self._recv_bind_ok)
687930
protected function registerConnectCallback()
    {
        $this->swoolePort->on('Connect', function ($server, $fd, $reactorId) {
            $this->dispatchEvent('Connect', $this->server, $this, $fd, $reactorId);
        });
    }
1011493
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]
999119
protected function addgroup_privat24(){
		$this->registerGroup(BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24'),'privat24',array(
			new BConfigFieldInt(
				'PAYMENT_PRIVAT24_MERCHANT_ID',
				BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_ID')),
			new BConfigFieldString(
				'PAYMENT_PRIVAT24_MERCHANT_PASS',
				BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_PASS')),
			new BConfigFieldList(
				'PAYMENT_PRIVAT24_MERCHANT_CURRENCY',
				BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_CURRENCY'),
				array(
					'UAH'=>'UAH',
					'USD'=>'USD',
					'EUR'=>'EUR',
					)
				),
			new BConfigFieldList(
				'PAYMENT_PRIVAT24_MERCHANT_ISTEST',
				BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_ISTEST'),
				array(
					0=>BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_ISTEST_0'),
					1=>BLang::_('ADMIN_CONFIG_PAYMENT_PRIVAT24_MERCHANT_ISTEST_1'),
					),
				0
				),

			));
		
		}
238100
def channels_set_join_code(self, room_id, join_code, **kwargs):
        """"""
        return self.__call_api_post('channels.setJoinCode', roomId=room_id, joinCode=join_code, kwargs=kwargs)
455292
def start(connection_or_group)
      @connection = connection_or_group
      @channel = AMQP::Channel.new(@connection)
      queue_options = {}
      name = queue_name
      if queue_type == :broadcast
        queue_options[:exclusive] = true
        queue_options[:auto_delete] = true
        name = "#{Socket.gethostname}-#{Process.pid}-#{self.object_id}"
        @queue = @channel.queue(name, queue_options)
        @exchange = @channel.fanout(BackgroundBunnies.broadcast_exchange_name(queue_name))
        @queue.bind(@exchange)
      else
        queue_options[:durable] = true
        @queue = @channel.queue(queue_name, queue_options)
      end
      @consumer = @queue.subscribe(:ack=>true) do |metadata, payload|
        info = metadata
        properties = nil
        begin 
          job = Job.new(JSON.parse!(payload), info, properties)
          err = nil
          self.process(job) 
          metadata.ack
        rescue =>err
          # processing went wrong, requeing message
          job = Job.new(nil, info, properties) unless job
          unless on_error(job, err)
            metadata.reject(:requeue=>true)
          else
            metadata.ack
          end
        end
      end
    end
831463
function Channel(connection, spec) {
    this.connection = connection;
    this.channelId = spec.channelId;
    this.canPublish = spec.canPublish;
    this.subscribedTopics = [];
    this.fireCallbacks = {};
    this.prepareCallbacks = {};

    ObjectFsm(this);
    this.initStateMachine();

    /* Hackery */
    this.reportTransition('uninitialized');
}
335058
def setup_exchange(self):
        
        logger.debug('Declaring exchange %s', self._exchange)
        self._channel.exchange_declare(self.on_exchange_declareok,
                                       self._exchange,
                                       self._exchange_type,
                                       durable=True)
1152421
def add(channel, client)
      @lock.synchronize do
        _remove(client) if @clients.include? client and @clients[client] != channel
        debug { "Adding #{client} to #{channel}." }
        @clients[client] = channel
        @channels[channel] = @channels[channel] ? @channels[channel] + 1 : 1
      end
    end
597322
def update_pipe_channel(self, uid, channel_name, label): # pylint: disable=unused-argument
        '''
        
        '''
        pipe_group_name = _form_pipe_channel_name(channel_name)

        if self.channel_layer:
            current = self.channel_maps.get(uid, None)
            if current != pipe_group_name:
                if current:
                    async_to_sync(self.channel_layer.group_discard)(current, self.channel_name)

                self.channel_maps[uid] = pipe_group_name
                async_to_sync(self.channel_layer.group_add)(pipe_group_name, self.channel_name)
1253420
def bind_to_channel(self):
        
        if self.channel.code_name != self.user.prv_exchange:
            channel = self._connect_mq()
            channel.exchange_bind(source=self.channel.code_name, destination=self.user.prv_exchange)
480197
private function registerLocalization()
    {
        $this->singleton(Contracts\Localization::class, Localization::class);

        if ($alias = $this->config()->get('localization.facade')) {
            $this->alias($alias, Facades\Localization::class);

            $this->registerAliases();
        }
    }
653616
async def connect(self):
        
        await self.node.join_voice_channel(self.channel.guild.id, self.channel.id)
994771
def groups_invite(self, *, channel: str, user: str, **kwargs) -> SlackResponse:
        
        self._validate_xoxp_token()
        kwargs.update({"channel": channel, "user": user})
        return self.api_call("groups.invite", json=kwargs)
913043
def _register_unicode(connection):
        
        psycopg2.extensions.register_type(psycopg2.extensions.UNICODE,
                                          connection)
        psycopg2.extensions.register_type(psycopg2.extensions.UNICODEARRAY,
                                          connection)
908312
def set_up(self, u, engine):
        """"""
        def connect_listener_enable_fk(connection, record):
            # fk must be enabled for all connections
            if not getattr(engine, "fk_disabled", False):
                return  # http://trac.buildbot.net/ticket/3490#ticket
                # connection.execute('pragma foreign_keys=ON')

        sa.event.listen(engine.pool, 'connect', connect_listener_enable_fk)
        # try to enable WAL logging
        if u.database:
            def connect_listener(connection, record):
                connection.execute("pragma checkpoint_fullfsync = off")

            sa.event.listen(engine.pool, 'connect', connect_listener)

            log.msg("setting database journal mode to 'wal'")
            try:
                engine.execute("pragma journal_mode = wal")
            except Exception:
                log.msg("failed to set journal mode - database may fail")