fix message

This commit is contained in:
anlicheng 2025-11-13 18:07:22 +08:00
parent 127daa3628
commit 5d7530b756

View File

@ -35,10 +35,14 @@ encode0(#auth_reply{code = Code, payload = Payload}) ->
]);
encode0(#jsonrpc_reply{result = Result, error = undefined}) ->
ResultBin = erlang:term_to_binary(#{<<"result">> => Result}),
iolist_to_binary([marshal(?Bytes, ResultBin)]);
iolist_to_binary([
marshal(?Bytes, ResultBin)
]);
encode0(#jsonrpc_reply{result = undefined, error = Error}) ->
ResultBin = erlang:term_to_binary(#{<<"error">> => Error}),
iolist_to_binary([marshal(?Bytes, ResultBin)]);
iolist_to_binary([
marshal(?Bytes, ResultBin)
]);
encode0(#pub{topic = Topic, content = Content}) ->
iolist_to_binary([
marshal(?Bytes, Topic),
@ -52,7 +56,9 @@ encode0(#command{command_type = CommandType, command = Command}) ->
encode0(#jsonrpc_request{method = Method, params = Params}) ->
ReqBody = erlang:term_to_binary(#{<<"method">> => Method, <<"params">> => Params}),
marshal(?Bytes, ReqBody);
iolist_to_binary([
marshal(?Bytes, ReqBody)
]);
encode0(#data{service_id = ServiceId, device_uuid = DeviceUUID, route_key = RouteKey, metric = Metric}) ->
iolist_to_binary([
marshal(?Bytes, ServiceId),