strainy / react-native-http-server Goto Github PK
View Code? Open in Web Editor NEWA simple http server implementation fo react native (Android)
License: MIT License
A simple http server implementation fo react native (Android)
License: MIT License
I just try to start the server services but didnt work ? how make it work ? i have try your simply sample
Use example, the port is 8181, but the local use of 127.0.0.1:8181 can not be accessed
Your library always makes error when I close app with the following stacktrace. Can you check and revise it?
FATAL EXCEPTION: main
Process: com.ohsupir, PID: 12983
java.lang.RuntimeException: Unable to destroy activity {com.ohsupir/com.ohsupir.MainActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.strainy.RNHttpServer.Server.stop()' on a null object reference
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5061)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5084)
at android.app.ActivityThread.access$1700(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1853)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.strainy.RNHttpServer.Server.stop()' on a null object reference
at com.strainy.RNHttpServer.RNHttpServerModule.stop(RNHttpServerModule.java:116)
at com.strainy.RNHttpServer.RNHttpServerModule.onHostDestroy(RNHttpServerModule.java:152)
at com.facebook.react.bridge.ReactContext.onHostDestroy(ReactContext.java:240)
at com.facebook.react.XReactInstanceManagerImpl.moveToBeforeCreateLifecycleState(XReactInstanceManagerImpl.java:618)
at com.facebook.react.XReactInstanceManagerImpl.onHostDestroy(XReactInstanceManagerImpl.java:550)
at com.facebook.react.XReactInstanceManagerImpl.onHostDestroy(XReactInstanceManagerImpl.java:557)
at com.facebook.react.ReactActivityDelegate.onDestroy(ReactActivityDelegate.java:142)
at com.facebook.react.ReactActivity.onDestroy(ReactActivity.java:72)
at android.app.Activity.performDestroy(Activity.java:7102)
at android.app.Instrumentation.callActivityOnDestroy(Instrumentation.java:1170)
at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:5039)
at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:5084)
at android.app.ActivityThread.access$1700(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1853)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Please add an option to make server which can be accessed from outside like another smartphone. Currently I manually revise com.strainy.RNHttpServer.Server like the following.
public Server(ReactContext context, int port, int timeout) {
// super("127.0.0.1", port);
super("0.0.0.0", port);
......
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.