title: How do I use Discord-RPC with Chrome Extension?
body: <p>I want to make a chrome extension which parses youtube/soundcloud/... pages and gets current song's name. Then it should update user's rich presence status in discord. Like a did it in python <a href="https://github.com/TomoriBot/Tomori-Player/blob/master/player.py" rel="nofollow noreferrer">there</a>.</p>
  
  <p>I have that one so far. Title already parsed, there's no problem. I have a problem with that code works. Because it doesn't work.</p>
  
  <pre class="lang-js prettyprint-override"><code>const clientId = '605777168739598338';
  const scopes = ['rpc', 'rpc.api'];
  
  const client = new RPC.Client({ transport: 'websocket' });
  
  client.connect();
  
  function updatePresence(title, time, icon) {
      title = title.replace(/["]/g, "\\\"");
      client.setActivity({
          details: title,
          startTimestamp: time,
          largeImageKey: icon
      }, 9999)
  }
  </code></pre>
  
  <p>I also tried raw websocket connection but I'm stupid..</p>
  
  <p>UPD:
  The code above is in content.js.</p>
  
  <p>browser.js is a file copied from root of module <a href="https://www.npmjs.com/package/discord-rpc" rel="nofollow noreferrer">discord-rpc</a> which i downloaded via npm.</p>
  
  <p>manifest.json</p>
  
  <pre><code>{
    "manifest_version": 2,
    "name": "Tomori Player",
    "version": "0.1.0",
    "browser_action": {
       "default_icon": "icon.png"
      },
      "background": {
          "scripts": ["browser.js"]
      },
      "permissions": [
          "ws://localhost:6463/*",
          "tabs",
          "webRequest",
          "webRequestBlocking"
      ],
    "content_scripts": [
        {
          "matches": [
            "https://www.youtube.com/watch*",
            "https://youtube.com/watch*"
          ],
          "js": ["content.js"]
        }
      ]
  }
  </code></pre>
  
  <p>P.S. I'm so sorry. I'm new in JS.</p>