Чтобы ответить на ваш вопрос
python
script.exports.something([0x33, 0x34, 0x35], 3)
js
rpc.exports = {
something: function (data, size) {
console.log(JSON.stringify(data), size);
// output: [51,52,53] 3
}
}
Более сложный пример, который, надеюсь, ответит на вопросы в будущем;
python сторона:
def on_message(msg, data):
if msg['payload'] == 'tag1':
print('bytes from js:', data)
# sending bytes to js
script.post({'type': 'tag2', 'payload': list([0x33, 0x34, 0x35])})
javascript сторона:
// send bytes to python
send("tag1", ptr(0x1234).readByteArray(64));
recv('tag2', function (value) {
var data = value.payload;
console.log('received bytes from python:', data, 'size:', data.length);
})
.wait(); // block until python respond