11package spp.protocol.extend
22
3- import spp.protocol.error.*
4- import spp.protocol.error.LiveInstrumentException.ErrorType
53import io.vertx.core.AsyncResult
64import io.vertx.core.Handler
75import io.vertx.core.Vertx
@@ -12,6 +10,8 @@ import io.vertx.core.json.JsonObject
1210import io.vertx.core.net.NetSocket
1311import io.vertx.ext.bridge.BridgeEventType
1412import io.vertx.ext.eventbus.bridge.tcp.impl.protocol.FrameHelper
13+ import spp.protocol.error.*
14+ import spp.protocol.error.LiveInstrumentException.ErrorType
1515
1616class TCPServiceFrameParser (val vertx : Vertx , val socket : NetSocket ) : Handler<AsyncResult<JsonObject>> {
1717
@@ -56,11 +56,16 @@ class TCPServiceFrameParser(val vertx: Vertx, val socket: NetSocket) : Handler<A
5656 }
5757 }
5858 } else {
59- val body = frame.getJsonObject(" body" )
60- if (body.fieldNames().size == 1 && body.containsKey(" value" )) {
61- // todo: understand why can't just re-send body like below
62- vertx.eventBus()
63- .send(" local." + frame.getString(" address" ), body.getValue(" value" ))
59+ val body = frame.getValue(" body" )
60+ if (body is JsonObject ) {
61+ if (body.fieldNames().size == 1 && body.containsKey(" value" )) {
62+ // todo: understand why can't just re-send body like below
63+ vertx.eventBus()
64+ .send(" local." + frame.getString(" address" ), body.getValue(" value" ))
65+ } else {
66+ vertx.eventBus()
67+ .send(" local." + frame.getString(" address" ), body)
68+ }
6469 } else {
6570 vertx.eventBus()
6671 .send(" local." + frame.getString(" address" ), body)
0 commit comments