You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've tried to get this library to work but it's really not my cup of tea. I've spent a day and I am not getting anywhere. I'd like to share some progress I made, hope it helps others or the author himself to resolve issues.
To get this library partially working, I did the following:
npx react-native link react-native-http-bridge
cd ios && pod install && cd ..
expo start -c
P.S: I have ejected expo 36.0.0 (which I think uses RN 0.61.4)
Example code:
importHttpBridgefrom'react-native-http-bridge'HttpBridge.start(5555,'http_service',function(req){console.log(req);// this function gets called 3 times for some reasonHttpBridge.respond(req.requestId,200,'application/json','{"message": "OK"}'// not able to receive this response);});fetch('http://127.0.0.1:5555/users').then(console.log)// no response here
iOS Build failures:
There are two locations where xcode build fails
start method. throws "// throws Use of undeclared identifier '_requestResponses'"
- completionBlock(requestResponse);+ if (completionBlock) completionBlock(requestResponse);
These changes seem to succeed the build but I am not sure if they have any side affects.
Logs:
Object {
"requestId": "1579266250521:175873",
"type": "GET",
"url": "/users",
}
Object {
"requestId": "1579266250524:571040",
"type": "GET",
"url": "/users",
}
Object {
"requestId": "1579266250526:557842",
"type": "GET",
"url": "/users",
}
Network request failed
- node_modules/whatwg-fetch/dist/fetch.umd.js:473:29 in xhr.onerror
- node_modules/event-target-shim/dist/event-target-shim.js:818:39 in EventTarget.prototype.dispatchEvent
- node_modules/react-native/Libraries/Network/XMLHttpRequest.js:574:29 in setReadyState
- node_modules/react-native/Libraries/Network/XMLHttpRequest.js:388:25 in __didCompleteResponse
- node_modules/react-native/Libraries/vendor/emitter/EventEmitter.js:190:12 in emit
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:436:47 in __callFunction
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:111:26 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:384:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:110:17 in __guard$argument_0
* [native code]:null in callFunctionReturnFlushedQueue
On Android I was unable to get the "react-native link" work, so it's unable to recognise start() method and throws
[Unhandled promise rejection: TypeError: null is not an object (evaluating 'Server.start')]
- node_modules/react-native-http-bridge/httpServer.js:13:12 in module.exports.start
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:271:30 in invoke
- node_modules/regenerator-runtime/runtime.js:45:44 in tryCatch
The text was updated successfully, but these errors were encountered:
Hi, I've tried to get this library to work but it's really not my cup of tea. I've spent a day and I am not getting anywhere. I'd like to share some progress I made, hope it helps others or the author himself to resolve issues.
To get this library partially working, I did the following:
P.S: I have ejected expo
36.0.0
(which I think uses RN 0.61.4)Example code:
iOS Build failures:
There are two locations where xcode build fails
start
method. throws "// throws Use of undeclared identifier '_requestResponses'"respond
method. throws "Thread 4: EXC_BAD_ACCESS (code=1, address=0x10)"These changes seem to succeed the build but I am not sure if they have any side affects.
Logs:
On Android I was unable to get the "react-native link" work, so it's unable to recognise
start()
method and throwsThe text was updated successfully, but these errors were encountered: