title: Yii2 share session between 2 apps
body: <p>Currently, my application have the following structure:</p>
  
  <ul>
  <li>frontend</li>
  <li>backend (user authenticated)</li>
  <li>client (user authenticated)</li>
  </ul>
  
  <p><strong>What I'm trying to do is to pass a flash message from the client to the frontend</strong>.</p>
  
  <p>In the client app I simple set the flash:</p>
  
  <pre><code>Yii::$app-&gt;session-&gt;setFlash('successMessage', 'My success message!');
  </code></pre>
  
  <p>And in the frontend:</p>
  
  <pre><code>Yii::$app-&gt;session-&gt;getFlash('successMessage');
  </code></pre>
  
  <p>But the above obviously is not working.</p>
  
  <p>I've already tried to set equal session id in the config/main.php of both apps, but there seems to be no different:</p>
  
  <pre><code>'components' =&gt; [
      'session' =&gt; [
          'name' =&gt; '_mySharedSessionId',
          'savePath' =&gt; __DIR__ . '/../runtime',  
      ],
      ...
  ]
  </code></pre>
  
  <p>Any ideas where I'm wrong?</p>
  
  <p><strong>UPDATE</strong>
  The problem maybe came from that I have set 4 different vhosts for each app: local-frontend, local-backend, local-client. If I revert it to the default, all seems to work fine. So my question now is:
  Is there an universal way to share a session between the above vhosts so that when the site is uploaded for production it will work also there (probably the urls on production will be something like www.mysite.com, www.client.mysite.com, www.admin.mysite.com)?</p>