inboxes icon indicating copy to clipboard operation
inboxes copied to clipboard

message apears twice with faye

Open danil-z opened this issue 14 years ago • 2 comments

Hello everyone i have a strange behavour - when i send a message it apears twice on page (but in database it's writen only once as normal). seems JS script with eval(data) runs twice. Why this might happen?

i've changed init.js.cofee to make sure

$ ->
  fayeUrl = window.location.protocol + "//" + window.location.hostname + ":9292/faye" # change port for post of your Faye daemon
  fayeJS = fayeUrl + ".js"
  $.getScript(fayeJS, (e)->
    faye = new Faye.Client(fayeUrl)
    faye.subscribe(window.location.pathname, (data)->
      console.log(data)
    )
  )

and in console i see:

$("#messages_box").append("<div class=\'message\'>\n  <p>\n    <span>\n      [email protected]\n      @\n      Пн, 03 дек. 2012, 05:08:28 +0000\n      :\n    <\/span>\n    <b>666<\/b>\n  <\/p>\n<\/div>\n");
    $("#new_message")[0].reset();
 init.js:11
    $("#messages_box").append("<div class=\'message\'>\n  <p>\n    <span>\n      [email protected]\n      @\n      Пн, 03 дек. 2012, 05:08:28 +0000\n      :\n    <\/span>\n    <b>666<\/b>\n  <\/p>\n<\/div>\n");
    $("#new_message")[0].reset();

my faye.ru has content:

require 'faye'
faye_server = Faye::RackAdapter.new(:mount => '/faye', :timeout => 45)
Faye::WebSocket.load_adapter('thin')
run faye_server

Could you give me some idea why this does happen?

danil-z avatar Dec 03 '12 05:12 danil-z

This could happen because the gem was tested only with Faye 0.7 which was released more than 1 year ago and now you have a newer version.

Or another guess, you have 2 init.js.coffee files: one from the gem, another from your app.

And I'm really sorry for answering so long :(

kirs avatar Mar 12 '13 08:03 kirs

Hello. Sorry, but this project is archived. Works by project no longer conducted.

dkoropenko avatar Jan 31 '19 13:01 dkoropenko