data not going out for send
See original GitHub issueI assume this is newbie issue.
My node-nanomsg class is receiving messages (Google Flatbufers (FB) ) just fine. When I connect to send, my client sees the connection and the tcp socket is bound. However, the does not seem to be starting.
What observe is that in this section: the this_pollSend is called only once on the first invokation of socket.send() but on subsequent calls it is not being triggered. To me it feels like something is getting stuck in the out-quue
Socket.prototype._startPollSend = function () {
if (!this._pollSend) {
this._pollSend = nn.PollSocket(this.binding, true, function (events) {
if (events) this.flush();
}.bind(this));
}
}
Below is how I have structured my class wrapper for NanoMSG:
const nano = require('nanomsg')
const flatbuffers = require('flatbuffers/js/flatbuffers').flatbuffers
const {Telemetry} = require('./Payloads/Telemetry')
const {Topics} = require('./messages/Packet')
class LMB {
constructor(config) {
this.sock
this.config = config
this.nodeName = config.nodeName
this.topicList = config.topicList
this.topics = Topics
this.topicMap = new Map([
[this.topics.simActorStateTest, new Telemetry()],
[this.topics.navActorStateTest, new Telemetry()] ])
}
connect() {
this.sock = nano.socket('bus')
this.sock.bind(this.config.urlList[0])
this.sock.connect(this.config.urlList[1])
this.sock.on('data', this.receive.bind(this))
this.sock.self = this;
}
//payload is a FB uint8 byte array, this method is being called in a loop every second. everything looks fine here,
send(topic, payload) {
let size = payload.length + 8
let packet = new ArrayBuffer(size)
let buffer = new Uint8Array(packet)
let view = new DataView(packet)
view.setUint32(0, topic)
view.setUint32(4, size)
buffer.set(payload, 8)
this.sock.send(buffer)
}
receive(packet) {
let view = new DataView(packet.buffer)
let topic = view.getUint32(0, true)
let size = view.getUint32(4, true)
let jPacket = {"topic": topic, "size": size}
let payload = packet.slice(8, packet.length-8)
this.topicMap.get(topic).parse(payload, jPacket)
console.log(JSON.stringify(jPacket, null, 4))
}
}
module.exports = { LMB }
The config file (where the connections are described looks like this (but as I said, my client is reporting that the nanoMSG JS sender is connecting fine, it is just the messages are not going over the “wire”
{
"nodeName": "YSG4206-Orchestrator",
"urlList": [ "tcp://10.4.30.239:2018", "tcp://10.4.30.239:2019" ],
"topicList": [ "sim.Actor.State.Test" ]
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:21 (2 by maintainers)
Top Results From Across the Web
Fix problems sending, receiving or connecting to Messages
Make sure your phone has background data turned on for the Messages app. Open your device's settings. Tap Network & internet and then...
Read more >How to Fix It When Mobile Data Is Not Working - Lifewire
Mobile data not working on an iPhone or Android can be caused by a damaged SIM card, software or hardware glitches, or a...
Read more >If you can't send or receive messages on your iPhone or iPad
Go to Settings > Messages > iMessage to see what phone numbers and email addresses you. If you receive messages on one device...
Read more >data and text work fine. Can not make or receive phone calls
Hi Neal,. First, restart your phone by holding the power button for 10 seconds. Make sure free calling apps like Viber, Tango or...
Read more >Cellular Data Not Working On iPhone? Here's The Fix!
0:00] 2. Make Sure Cellular Data Is Turned On [ ; 0:27] 3. Switch Up Your Voice And Data Setting [ ; 0:55]...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Bus is not the issue. I was missing an await. Now I have a different issue. The data I am putting into the header of the packet (before the payload) is with the wrong endian depending on whether it is from the C++ or Javascript side. That is not your issue. It is mine!
lol sure, if you’re doing C++ strings with
std::stringthen you can relax and don’t worry about itBjarne Stroustrup appends the terminating zero for you
🌴