Http2 Client in Angular 7 - angular7

I want to use http2 for client side in my angular project.
I installed http2 with "npm install http2" command and I used sample client code in http2-npm.
However, I'm getting below warning
WARNING in ./node_modules/http2/lib/protocol/index.js 46:12-19
Critical dependency: require function is used in a way in which
dependencies cannot be statically extracted
With F12 on the page, Console error;
ERROR ReferenceError: process is not defined
at Object../node_modules/http2/lib/protocol/framer.js (framer.js:12)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/http2/lib/protocol/endpoint.js (endpoint.js:3)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/http2/lib/protocol/index.js (index.js:41)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/http2/lib/http.js (http.js:136)
at __webpack_require__ (bootstrap:79)
at Object../node_modules/http2/lib/index.js (index.js:18)
at __webpack_require__ (bootstrap:79)
Thus, I cannot get data from server using http2 client. How can I fix these problem?

You don’t need a library for client side HTTP/2. The browser will automatically use HTTP/2 is the server supports it and use HTTP/1.1 I’d it doesn’t.
That’s one of the great things about the way HTTP/2 was implemented - it’s basically seamless to higher level applications like JavaScript.
Of course you might decide to tweak your app differently if HTTP/2 is being used (e.g. bundle less, or push) but those are mostly (and perhaps best) handled the on the server side.

Related

RNEncryptedStorage is undefined in react-native-web

I'm developing ios and web app. For storing credentials using encrypted storage, and in web I'm using local storage for now.
But at the time of compiling web app throws error.
rnw_blogpost.bundle.js:5540 Uncaught Error: RNEncryptedStorage is
undefined at eval (EncryptedStorage.js:1:862) at
Object../node_modules/react-native-encrypted-storage/lib/module/EncryptedStorage.js (rnw_blogpost.bundle.js:1766:1) at __webpack_require__
(rnw_blogpost.bundle.js:5537:33) at fn
(rnw_blogpost.bundle.js:5736:21) at eval (index.js:1:389) at
Object../node_modules/react-native-encrypted-storage/lib/module/index.js
(rnw_blogpost.bundle.js:1776:1) at __webpack_require__
(rnw_blogpost.bundle.js:5537:33) at fn
(rnw_blogpost.bundle.js:5736:21) at eval (encrypted-storage.ts:1:565)
at Object../src/util/encrypted-storage.ts
(rnw_blogpost.bundle.js:4098:1)
This is due to https://github.com/emeraldsanto/react-native-encrypted-storage/blob/master/src/EncryptedStorage.ts#L7
Is there any way, that in web I can handle it.
Looks to me like this might be a keychain permissions issue – the error in the source code doesn't show what is happening, but it looks like the system isn't able to import RNEncryptedStorage at all. Other possibility is that it may just be a missing dependency – have you tried pod install?

Running a headless WKWebView in Swift

Apple is requiring all Safari extensions to switch over to "Safari App Extensions" which specifies the backend be written in Swift instead of JavaScript.
To reduce rewriting and duplicating code as much as possible I'd like to run a headless WKWebView that runs my current JavaScript code and have Swift act as a bridge to/from the WKWebView JavaScript. (We can't use the JavaScriptCore module because we require WebKit apis like Window, XMLHttpRequest, localstorage, etc)
Currently I'm getting the following errors when trying to load the WKWebView as headless and I think they have to do with the fact that I'm not adding the view as a subview to anything. see com.apple.WebKit.WebContent drops 113 error: Could not find specified service
2018-12-06 17:36:28.464054-0800 Extension[12768:12452197] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service
2018-12-06 17:36:28.490149-0800 Extension[12768:12452197] Could not signal service com.apple.WebKit.Networking: 113: Could not find specified service
If anyone has any experience with Swift, WKWebView, Safari App Extensions, etc. your advice would be greatly appreciated. Thanks for reading!

flow error for Highcharts

I've added module highcharts in Flow project as it is written over here. Basically the problem is that whenever I use library Highcharts , I have to put into the code import Highcharts from "highcharts"; The results outcome with no errors in FlowJs interface, but with error in browser Unexpected token import( so it doesn't compile js file properly) . Does anyone know the answer for that? I would be appreciated!
Flow in general uses nonstandard syntax for type annotations, etc. In your case, the import is standard ES6 syntax, but it's not yet supported in whatever browser you are using.
Either way, the solution is to use Babel to transpile your code. You can configure it to target older versions of JavaScript and to strip Flow types. There's a bit more info about using it with Flow on the Running Flow code page.

How do I get polyfills to work with Relay?

I have a PHP app and I'm trying to use it with GraphQL and Relay, but trying to get Relay working I keep getting this error in my Browser (Chrome and Safari)
warning.js:36 Warning: Relay relies on polyfills for ES6 features in older browsers. Babel provides a good one: https://babeljs.io/docs/usage/polyfill/
I've tried all sorts of things, and I can't seem to get it to work.
Change webpack configuration, include the polyfill.js as a script.
I can't ignore that warning, because later on I will get:
RelayTaskQueue.js:97 Uncaught TypeError: _promise2.default is not a constructor
I managed to fix the problem myself. The problem was that I was running on Mac OS X with a case insensitive file system.
I tried creating a disk image with case sensitivity, and it worked. Followed instructions here. https://gist.github.com/dixson3/8360571 #

ZF2 + APC = fatal errors

I did a simple install of APC (no special configurations) and didn't integrate with code at all (letting it go default and making sure things work). I was super impressed to see my New Relic times drop from 300ms to 50ms right after I enabled it! But then I noticed that actually, the server is crashing immediately. Here's the problem:
After I restart Apache, the first request works. Following the first request, I get a slew of errors in my error logs.
Some of these errors are:
Call to a member function getFieldValue() on a non-object in Zend/Http/PhpEnvironment/Request.php (zf2 lib)
Undefined Property:
Zend\\Http\\Headers::$h\x9b\xecv\xb9\x7f in Zend/Http/Headers.php
Is there some magic I'm missing? These seem like errors out of my control.
It is recommended by the ZF community to use opcache instead of APC cache. This was enabled with the default installation requirements and everything worked.

Resources