|
@@ -17,6 +17,9 @@ namespace JCEngineCore {
|
|
|
public static void reboot(JCEntity entity) {
|
|
public static void reboot(JCEntity entity) {
|
|
|
new JCEngineCore.WebSocketServer(url, entity);
|
|
new JCEngineCore.WebSocketServer(url, entity);
|
|
|
}
|
|
}
|
|
|
|
|
+ public static void bootNew(string url, JCEntity entity) {
|
|
|
|
|
+ new JCEngineCore.WebSocketServer(url, entity);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
public class JCEntity {
|
|
public class JCEntity {
|
|
|
public int id;
|
|
public int id;
|
|
@@ -164,7 +167,11 @@ namespace JCEngineCore {
|
|
|
IEnumerator doHeartBeat() {
|
|
IEnumerator doHeartBeat() {
|
|
|
while (true) {
|
|
while (true) {
|
|
|
try {
|
|
try {
|
|
|
- call("doHeartBeat");
|
|
|
|
|
|
|
+ if (webSocket.IsOpen) {
|
|
|
|
|
+ call("doHeartBeat");
|
|
|
|
|
+ } else {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
} catch (System.Exception) {}
|
|
} catch (System.Exception) {}
|
|
|
yield return new WaitForSecondsRealtime(5f);
|
|
yield return new WaitForSecondsRealtime(5f);
|
|
|
}
|
|
}
|