(function(mod) {
    if (typeof exports == "object" && typeof module == "object") // CommonJS
        return mod(require("tern/lib/tern"));
    if (typeof define == "function" && define.amd) // AMD
        return define(["tern/lib/tern" ], mod);
    mod(tern);
})(function(tern) {
    "use strict";
  
  function createWebSocketServer(server) {
    var WebSocketServer = require('ws').Server;
    server.wss = new WebSocketServer({ server: server.parent });
  }
  
  tern.Server.prototype.sendToClient = function(data) {
    var wss = this.wss;
    if (wss) wss.clients.forEach(function each(client) { client.send(JSON.stringify(data)); }); // node context
    else this.signal('sendToClient', data); // browser context
  };
  
  tern.registerPlugin("push", function(server, options) {
    if (server.parent) {
      createWebSocketServer(server);
    }  
  });
    
})
@@ -405,20 +405,14 @@
     
-server.wss =
+return
  new
@@ -451,16 +451,27 @@
 r.parent
+.httpServer
  %7D);%0D%0A  
@@ -525,16 +525,22 @@
 unction(
+type, 
 data) %7B%0D
@@ -649,20 +649,44 @@
 ringify(
-data
+%7B%22type%22: type, %22data%22: data%7D
 )); %7D); 
@@ -727,22 +727,12 @@
 nal(
-'sendToClient'
+type
 , da
@@ -850,18 +850,59 @@
 rent
-) %7B%0D%0A     
+ && server.parent.httpServer) %7B%0D%0A      server.wss =
  cre

Add type for senToClient.