feat:pass the breakpoint debug

This commit is contained in:
pengfei.zhou 2019-10-25 13:41:14 +08:00
parent 20ca4b013d
commit 8ce32b8769
3 changed files with 7 additions and 6 deletions

View File

@ -40,7 +40,7 @@ public class RemoteJSExecutor {
.readTimeout(10, TimeUnit.SECONDS) .readTimeout(10, TimeUnit.SECONDS)
.writeTimeout(10, TimeUnit.SECONDS) .writeTimeout(10, TimeUnit.SECONDS)
.build(); .build();
final Request request = new Request.Builder().url("ws://192.168.24.166:2080").build(); final Request request = new Request.Builder().url("ws://192.168.24.221:2080").build();
final Thread current = Thread.currentThread(); final Thread current = Thread.currentThread();
webSocket = okHttpClient.newWebSocket(request, new WebSocketListener() { webSocket = okHttpClient.newWebSocket(request, new WebSocketListener() {
@ -116,7 +116,7 @@ public class RemoteJSExecutor {
} catch (Exception ex) { } catch (Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} finally { } finally {
//LockSupport.unpark(current); LockSupport.unpark(current);
} }
} }
break; break;
@ -165,7 +165,7 @@ public class RemoteJSExecutor {
jo.addProperty("hashKey", hashKey); jo.addProperty("hashKey", hashKey);
webSocket.send(gson.toJson(jo)); webSocket.send(gson.toJson(jo));
// LockSupport.park(Thread.currentThread()); LockSupport.park(Thread.currentThread());
return null; return null;
} }

View File

@ -67,7 +67,7 @@ public class ValueBuilder {
write(output, key); write(output, key);
write(output, ((JSONObject) O).opt(key)); write(output, ((JSONObject) O).opt(key));
} }
writeInt(output, 0); output.write((byte) 'N');
} else if (O instanceof JSONArray) { } else if (O instanceof JSONArray) {
output.write((byte) 'A'); output.write((byte) 'A');
writeInt(output, ((JSONArray) O).length()); writeInt(output, ((JSONArray) O).length());

View File

@ -24,12 +24,13 @@ global.Entry = doric.jsObtainEntry(contextId)
const wss = new WebSocket.Server({ port: 2080 }) const wss = new WebSocket.Server({ port: 2080 })
wss.on('connection', function connection(ws) { wss.on('connection', function connection(ws) {
console.log('Connected')
ws.on('message', function incoming(message: string) { ws.on('message', function incoming(message: string) {
let messageObject = JSON.parse(message) let messageObject = JSON.parse(message)
switch (messageObject.cmd) { switch (messageObject.cmd) {
case "injectGlobalJSFunction": case "injectGlobalJSFunction":
console.log(messageObject.name) console.log(messageObject.name)
Reflect.set(global, messageObject.name, function() { Reflect.set(global, messageObject.name, function () {
let args = [].slice.call(arguments) let args = [].slice.call(arguments)
console.log("===============================") console.log("===============================")
console.log(args) console.log(args)
@ -46,7 +47,7 @@ wss.on('connection', function connection(ws) {
console.log(messageObject.functionName) console.log(messageObject.functionName)
let args = [] let args = []
for (let i = 0;i < messageObject.javaValues.length;i++) { for (let i = 0; i < messageObject.javaValues.length; i++) {
let javaValue = messageObject.javaValues[i] let javaValue = messageObject.javaValues[i]
if (javaValue.type === 0) { if (javaValue.type === 0) {
args.push(null) args.push(null)