Using the provided WebSocket example under react-native 0.17, the sample code throws the following error:
"TypeError: ws.on is not a function(…)"
It's listening on ".on" which does not exist, rather than assigning a function to onopen, onmessage, onerror and onclose.
See: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket
- Mention that Fetch returns a Promise
(makes example with .then clearer to newcomers to ES6/ES7)
- Add example of Fetch usage with second argument
(helps clarify how e.g., a POST request to an API might be constructed)
- Add async/await example