title: WKErrorDomain error 4 from WKWebView when calling existing JSFunction
body: <p>No matter what I do, I can't call this js function successfully without generating error.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function getmessage() {
          //$('#discussion').append('&lt;li&gt;dummy&lt;/li&gt;');
      }
      $(function () {
          var chat = $.connection.chatHub;
          chat.client.broadcastMessage = function (message) {
              var encodedMsg = $('&lt;div /&gt;').text(message).html();
              $('#discussion').append('&lt;li&gt;' + encodedMsg + '&lt;/li&gt;');
          };
          $.connection.hub.start().done(function () {
              $('#sendmessage').click(function () {
                  chat.server.send($('#message').val());
              });
          });
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>error: WKErrorDomain code; 4</p>
  
  <p>I have made sure that I inherit WKNavigaitonDelegate, set view as it's delegate and calling it from didFinishNavigation</p>
  
  <p>Note that I can execute new js blocks just fine from my swift code with no issues, but when calling that existing function, it doesn't work. </p>
  
  <p><a href="https://i.stack.imgur.com/UcQG0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UcQG0.png" alt="enter image description here"></a></p>