W
W
winolog2011-10-05 15:30:09
Node.js
winolog, 2011-10-05 15:30:09

Node js Socket.IO

Good afternoon.
There was a problem with the Node. Unfortunately, I couldn't find an explanation anywhere.
After N time, the server stops sending a message to the client, but the messages that are called by the connect event continue to process correctly.

piece of code

var io = require('socket.io').listen(801)

tail.stdout.addListener("data", function (data) {

io.sockets.json.send({'data_new': (s) }); // stops working
...
}

io.sockets.on('connection', function (socket) {

socket.on('message', function (msg) {... } // This part works as expected.

Thanks.

Answer the question

In order to leave comments, you need to log in

5 answer(s)
T
TEHEK, 2011-10-05
@TEHEK

And what gives the debug of this section? If you put a breakpoint there after it "stops working", will the interpreter go there? It's more like the socket dropped out of the collection in io.sockets, but stayed alive inside the closure. Maybe some local disconnect?
tail.stdout.addListener(«data», function (data) {

io.sockets.json.send({'data_new': (s)}); // перестает работать.

}

W
winolog, 2011-10-05
@winolog

socket = io.connect('http://*.*.*.*:801'); - on the client side
The scheme of the application is as follows
There is a port 9999 GPS Node Server data comes from it Via var tail = spawn('telnet', ['85.192.128.99', '9999']);
collects and processes data. When connected, the server sends the accumulated data, and then starts transmitting the incoming data from port 9999 to the client in real time.

W
winolog, 2011-10-05
@winolog

Yes it comes. in Chrome, you can notice that some xhr packets seem to come from the server, but they are not displayed and the logs give the impression that the server is trying to send to the wrong client id because (right now I can’t show the log exactly, the error does not occur immediately, but after 5 hours +)
something like
Connect client id = 777
writing 4::
xhr-polling closed due to exceeded duration
client 222 exceed time is written

W
winolog, 2011-10-05
@winolog

Now I will try to configure.
debug - setting poll timeout
debug - discarding transport
debug - cleared close timeout for client 2245086562112165676
debug - clearing poll timeout
debug - xhr-polling writing 8::
debug - set close timeout for client 401565802907730959
debug - xhr-polling closed due to exceeded duration
debug - setting request GET /socket.io/1/xhr-polling/401565802907730959?t=1317843052327 debug
- setting poll timeout
debug - discarding transport
debug - cleared close timeout for client 401565802907730959
debug - fired close timeout for client
464225284389499193
— discarding transport
debug - client authorized
info - handshake authorized 20175460221322298742
debug - setting request GET /socket.io/1/jsonp-polling/20175460221322298742?t=1317843055307&i=558
debug - setting poll timeout
debug - client authorized for
debug - clearing poll timeout
debug - jsonppolling writing io.j[558]("1::");
debug - set close timeout for client 20175460221322298742
debug - setting request GET /socket.io/1/jsonp-polling/20175460221322298742?t=1317843055712&i=558
debug - setting poll timeout
debug - clearing poll timeout
debug - jsonppolling writing io.j[558 ]("4:::{\"event\":\"connected\"}");
debug - set close timeout for client 20175460221322298742
debug - discarding transport
debug - cleared close timeout for client 20175460221322298742
debug - fired close timeout for client 16139908521934804329
info - transport end
debug - discarding transport
debug - jsonppolling received data packet 4:::{"id":"2"}
debug - client authorized
info - handshake authorized 2077497499272987050
Here. Time passed and I was able to tear out a piece of the log.

W
winolog, 2011-10-05
@winolog

Damn… this is probably not worthy of a bug report. I suspect that the reason is that telnet flies by timeout and the event stops being called.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question