THRIFT-5003: Websocket Connection in Browsers with nodejs code

* changed this to self in forEach callback

* updated minimum node version to 8.16.2 (Maintenance LTS until December 2019)
changed ws_connection.js to work in the browser, with isomorphic-ws
added exports for `wsConnection`, `createWSConnection`, `createWSClient`

* added exports for WSConnection to browser.js

* extended the sample of nodejs code in the browser with webpack

* tested and updated node version to LTS 10.18.0 Dubnium
discussion based: https://github.com/apache/thrift/pull/1927#discussion_r358140463
diff --git a/package.json b/package.json
index c674fef..c803df5 100644
--- a/package.json
+++ b/package.json
@@ -33,14 +33,19 @@
   "browser": "./lib/nodejs/lib/thrift/browser.js",
   "main": "./lib/nodejs/lib/thrift",
   "engines": {
-    "node": ">= 4.1.0"
+    "node": ">= 10.18.0"
   },
   "dependencies": {
+    "browser-or-node": "^1.2.1",
+    "isomorphic-ws": "^4.0.1",
     "node-int64": "^0.4.0",
     "q": "^1.5.0",
-    "ws": "^5.0.0"
+    "ws": "^5.2.2"
   },
   "devDependencies": {
+    "@types/node": "^10.12.6",
+    "@types/node-int64": "^0.4.29",
+    "@types/q": "^1.5.1",
     "buffer-equals": "^1.0.4",
     "commander": "^2.14.1",
     "connect": "^3.6.6",
@@ -49,15 +54,12 @@
     "eslint-plugin-prettier": "^3.0.0",
     "html-validator-cli": "^4.1.4",
     "istanbul": "^0.4.5",
-    "jsdoc": "^3.5.5",
+    "jsdoc": "^3.6.3",
     "json-int64": "^1.0.0",
     "prettier": "^1.14.3",
     "tape": "^4.9.0",
-    "utf-8-validate": "^4.0.0",
     "typescript": "^3.1.6",
-    "@types/node": "^10.12.6",
-    "@types/node-int64": "^0.4.29",
-    "@types/q": "^1.5.1"
+    "utf-8-validate": "^4.0.0"
   },
   "scripts": {
     "cover": "lib/nodejs/test/testAll.sh COVER",