Tuesday, 15 July 2014

javascript - Squaremo amqplib offline messages -


NB: I have tried to do several amqp libraries with nodes (and) and it seems that we can not use offline message, so i

< P> I use the introduction:

I need to create a mobile backend with realtime socket exchanges, regardless of network loss. / P>

I have searched something and it seems that using a message broker is a good idea. So I documented myself and tried to apply some things. Here, I am using

, the fact is that I can use different queues and exchange types, like fanout, when I have a complete and fixed network connection.

I got some information about changing the type of my queue and setting it to "durable: true" and "auto delet: false", but it does not seem to work Happen.

I need to manage offline message management to work in any way

What I've written:

< / P>
  var amqp = require ('amqplib'); Requires Var app = ('Express') (); Var requires server = ('http'). Server (app); Var io = requires ('socket.io') (server, {'pingtimeout': 10000, 'ping interval': 5000}); App.get ('/', function (rik, ridge) {res.sendfile (__DIN name + '/ index_');}); Server.listen (8888); Amqp.connect ('amq: // localhost') .then (function (conn, err) {if (err! = Null) {console.log (err);} else {return conn.createChannel (). (Ch, err) {if (err! = Null) {console.log (err);} else {io.sockets.on ('connection', function (socket) {ch.assertExchange ('logs', 'fanout' , {Durable: wrong}}. Then (function () {socket.on ('message', function (msg) {ch.publish ('log', '', new buffer (msg)}}; return ch. AssertQueue ('', {durable: true, auto delet: wrong});}). Then (function (qok) {return ch.bindQueue (qok.queue, 'logs', '') .then (function () { Return qok.queue;});}). (Function (queue) {return ch.consume (queue, quo consommed, {noAck: true});}; function queue processed (msg) {socket.emit (' News', msg.content.toStri Ng ());}}}}}  

question

  • Library offline messaging How can control, how can the socket be timeout? Clearly, how can it handle the timeout and heartbeat of the socket. IO?

  • In this library, the developer dealt with "channel" which I did not find in the documentation. What is a channel? A user connection?

  • What should I change to manage a strong and good offline messaging between my backend, a browser and a smartphone?


No comments:

Post a Comment