8 public static function receive($userId, $connectionString)
10 if(static::checkState())
12 $connection = static::parseConnectionString($connectionString);
16 $uri =
new Uri($connection[
'endpoint']);
20 $dbRes = ApTable::getList(array(
22 '=USER_ID' => $userId,
23 '=DOMAIN' => $uri->getHost()
25 'select' => array(
'ID')
27 $existingEntry = $dbRes->fetch();
30 $result = ApTable::update($existingEntry[
'ID'], array(
31 'ENDPOINT' => $uri->getLocator(),
32 'LAST_AUTHORIZE' =>
'',
37 $result = ApTable::add(array(
39 'DOMAIN' => $uri->getHost(),
40 'ENDPOINT' => $uri->getLocator(),
44 return $result->isSuccess();