expo-http-server 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -18,6 +18,7 @@ class ExpoHttpServerModule : Module() {
|
|
|
18
18
|
val body: String)
|
|
19
19
|
|
|
20
20
|
private var server: Server? = null;
|
|
21
|
+
private var started = false;
|
|
21
22
|
private val responses = HashMap<String, SimpleHttpResponse>()
|
|
22
23
|
|
|
23
24
|
private val requestHandler: RequestHandler = { request: Request, response: Response ->
|
|
@@ -70,11 +71,14 @@ class ExpoHttpServerModule : Module() {
|
|
|
70
71
|
"message" to "Server not setup / port not configured"
|
|
71
72
|
))
|
|
72
73
|
} else {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
"
|
|
77
|
-
|
|
74
|
+
if (!started) {
|
|
75
|
+
started = true
|
|
76
|
+
server?.start()
|
|
77
|
+
sendEvent("onStatusUpdate", bundleOf(
|
|
78
|
+
"status" to "STARTED",
|
|
79
|
+
"message" to "Server started"
|
|
80
|
+
))
|
|
81
|
+
}
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
|
|
@@ -86,6 +90,7 @@ class ExpoHttpServerModule : Module() {
|
|
|
86
90
|
}
|
|
87
91
|
|
|
88
92
|
Function("stop") {
|
|
93
|
+
started = false
|
|
89
94
|
server?.close()
|
|
90
95
|
sendEvent("onStatusUpdate", bundleOf(
|
|
91
96
|
"status" to "STOPPED",
|